7 Replies Latest reply on Jan 29, 2008 5:58 PM by Reind D

    Ear with multiple web modules - problem with components.xml

    Reind D Newbie

      I'm in the process of migrating from seam 1.2 to 2.0.1CR1 and I've run into a problem. My application is packaged as an ear, with multiple web modules (each with their own components.xml, pages.xml, etc). The java classes used by all web modules are packaged in a single jar.

      my-application.ear/
       jboss-seam.jar
       lib/
       META-INF/
       a.war/
       WEB-INF/
       classes/
       seam.properties
       components.xml
       ...
       b.war/
       WEB-INF/
       classes/
       seam.properties
       components.xml
       ...
       web.jar/
       META-INF/
       seam.properties
       ...
      


      It looks like the components.xml file is not working as it should. I've noticed this with my login:

      The following doesn't work in components.xml
      <security:identity authenticate-method="#{authenticator.authenticate}" />


      The #authenticate method is never called.

      This problem goes away if I list only 1 web module in app.ear/META-INF/application.xml.

      I believe this same setup worked with seam 1.2, but is no longer working in seam 2.0.1CR1.

      I've also tried creating an empty jar file a.jar, b.jar with seam.properties in the root. That hasn't helped either.

      Any ideas?

        • 1. Re: Ear with multiple web modules - problem with components.
          Reind D Newbie

          Ugly workaround:

          Everything works as expected if I:
          1) start Jboss as normal
          2) undeploy my ear (move it to a temp dir)
          3) redeploy it (move it back into the deploy dir)

          Note. for this to work I must also package those extra dummy jars (they only have 1 file - seam.properties).

          But, if I just start JBoss normally, then the aforementioned problem occurs.

          I've tried with both JBoss 4.2.2 and 4.2.0, and both have this problem.

          That's obviously not a good solution =-). i'd appreciate any suggestions.

          • 2. Re: Ear with multiple web modules - problem with components.
            Pete Muir Master

            Can you report a JIRA issue and file a simple test case?

            • 3. Re: Ear with multiple web modules - problem with components.
              Reind D Newbie

              Pete,

              Thanks for the reply. I'm creating a test app now, and will submit it to JIRA.

              Is there anything you suggest I try, in order to isolate the issue? I've only noticed this behavior because the following stopped working:

              <security:identity authenticate-method="#{authenticator.authenticate}" />


              • 4. Re: Ear with multiple web modules - problem with components.
                Reind D Newbie

                Ok, it's starting to make more sense (though the behavior has changed since since moving to seam 2 from 1.2)

                I have several components.xml files, each of which configure the Identity authenticate-method to use a different auth component & method:
                a.war:

                <security:identity authenticate-method="#{authA.authenticate}" />


                b.war:
                <security:identity authenticate-method="#{authB.authenticate}" />


                When I login to "b" it will call the authentication-method declared for a.war (instead of the one configured in b.war/WEB-INF/components.xml).

                • 5. Re: Ear with multiple web modules - problem with components.
                  Reind D Newbie

                  It looks like seam needs to be loaded multiple times - once for each web module - to configure the built in components differently. I had mostly the same structure using seam 1.2 and this worked, so I'm not sure what's changed.

                  If I only have one module then it correctly invokes the authenticate-method configured in the components.xml file.

                  • 6. Re: Ear with multiple web modules - problem with components.
                    Reind D Newbie

                    I've filed a JIRA issue:
                    http://jira.jboss.org/jira/browse/JBSEAM-2523

                    From what I've found it looks like the Identity component is not scopped to the appropriate WAR. If you have an EAR with multiple WARs it's not clear which Identy component (which components.xml configuration) will apply.

                    • 7. Re: Ear with multiple web modules - problem with components.
                      Reind D Newbie

                      Took a while but I found a solution (or, rather, the cause) of this issue.

                      I removed he MyFacesExtensionsFilter from every web.xml file and now Authentication works as expected:

                      remove from web.xml

                      <filter>
                      <filter-name>MyFacesExtensionsFilter</filter-name>
                      <filter-class>
                      org.apache.myfaces.webapp.filter.ExtensionsFilter
                      </filter-class>
                      <init-param>
                      <description>
                      Set the size limit for uploaded files. Format: 10 - 10
                      bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
                      </description>
                      <param-name>maxFileSize</param-name>
                      <param-value>20m</param-value>
                      </init-param>
                      </filter>
                      <filter-mapping>
                      <filter-name>MyFacesExtensionsFilter</filter-name>
                      <servlet-name>Faces Servlet</servlet-name>
                      </filter-mapping>
                      <filter-mapping>
                      <filter-name>MyFacesExtensionsFilter</filter-name>
                      <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                      </filter-mapping>


                      I've closed the JIRA bug.