Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1852

Invalid warning WELD-ENV-001004

    XMLWordPrintable

Details

    Description

      When discovery kicks in and the WebAppBeanArchiveScanner does its thing, there is a warning that is printed out that is bogus.

      WELD-ENV-001004: Found both WEB-INF/beans.xml and WEB-INF/classes/META-INF/beans.xml. It's not portable to use both locations at the same time. Weld is going to use file:/home/joakim/code/path/to/WEB-INF/beans.xml.

      Because of the following code ...

                  // WEB-INF/classes
                  URL beansXmlUrl = null;
                  for (String resource : RESOURCES) {
                      URL resourceUrl;
                      resourceUrl = servletContext.getResource(resource);
                      if (beansXmlUrl != null) {
                          WeldServletLogger.LOG.foundBothConfiguration(beansXmlUrl);
                      } else {
                          beansXmlUrl = resourceUrl;
                      }
                  }
      

      If the "/WEB-INF/beans.xml" exists, and the "/WEB-INF/classes/META-INF/beans.xml" does not, then this warning is printed out.

      The conditional should be

                      if ( (resourceUrl != null) && (beansXmlUrl != null) ) {
                          WeldServletLogger.LOG.foundBothConfiguration(beansXmlUrl);
                      } else {
      

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            joakim.erdfelt@gmail.com Joakim Erdfelt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: