4 Replies Latest reply on Feb 17, 2009 11:09 PM by vincent.crepin

    Multiple versions of same application

    vincent.crepin

      Hello all.


      Has anybody succeeded into deploying 2 versions of the same app (ear) on the same JBOSS box ?


      The 2 ears use different classloaders and java2ParentDelegation false (jboss-app.xml).
      They are named differently (of course).
      They use different context-roots for the servlets.
      They use a different jndiContext.


      The only thing they share is the datasource.


      There is no problem deploying those 2 ears. Looking at the jboss log, everything seems fine. The second application that gets deployed works without any problem. The first one though does not work. It fails when using Component.getInstance() stating that there is no active application context.


      If I remove the second app, the first one starts working. And if I deploy 3 versions, its always the last one that works.


      What context could be shared between the 2 ? Anybody ever encountered this ?


      Thank you.

        • 1. Re: Multiple versions of same application
          barakka

          Hi,


          I managed to have two seam (almost identical) applications running on the same jboss. On top of what you have said, I had to take care not to use the same entity factory name in the persistence.xml otherwise the first application deployed was not working. However, your problem seems not to be related with persistence, but rather with (I guess) with the seam servlet. Maybe by posting some part of the jboss bootstrap log we can understand better what is going on...


          Best,
          Riccardo.

          • 2. Re: Multiple versions of same application
            vincent.crepin

            Thank you Riccardo for this fast answer.


            There are quite a few lines like that in the console output:




            Thanks again for your help.



            12:17:29,280 INFO  [Initialization] reading /WEB-INF/components.xml
            12:17:29,327 INFO  [Initialization] reading properties from: /seam.properties
            12:17:29,342 INFO  [Initialization] reading properties from: /jndi.properties
            12:17:29,342 INFO  [Initialization] initializing Seam
            12:17:29,452 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.persistence.persistenceProvider
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.expressions
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.userPrincipal
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.resourceLoader
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.parameters
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.locale
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.manager
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.transaction.synchronizations
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.locale
            12:17:29,468 INFO  [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.isUserInRole
            12:17:29,499 INFO  [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init
            12:17:29,577 INFO  [Initialization] Installing components...
            12:17:29,624 INFO  [Component] Component: authenticator, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: com.tm.mfx.ts.session.AuthenticatorImpl, JNDI: TicketingServices_14_0_0_2/AuthenticatorImpl/local
            12:17:29,671 INFO  [Component] Component: com_tm_mfx_ts_common_json_services_JSONService, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: com.tm.mfx.ts.common.json.services.JSONServiceImpl, JNDI: TicketingServices_14_0_0_2/JSONServiceImpl/local





            If you need other output lines, let me know please.


            • 3. Re: Multiple versions of same application
              barakka

              Hi,


              these look normal. You should try to focus on any message given by the SeamPhaseListener (something like There should only be one Seam phase listener per application might be a spoiler that the classloaders are not actually different).


              Maybe also the error stacktrace, just to check when exactly the code is trying to access the application context.


              I'm also guessing that no @In injection works, failing with the same error?


              R.

              • 4. Re: Multiple versions of same application
                vincent.crepin

                Hi, the word SeamPhaseListener appears nowhere in the console output. In server.log, I see exactly twice the following (2 ears are deployed):


                2009-02-17 12:17:23,796 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] Adding PhaseListener 'org.jboss.seam.jsf.SeamPhaseListener' to lifecycle 'org.jboss.seam.jsf.SeamPhaseListener}
                2009-02-17 12:17:23,796 DEBUG [javax.enterprise.resource.webcontainer.jsf.lifecycle] addPhaseListener(ANY 0,org.jboss.seam.jsf.SeamPhaseListener)
                


                but no warning or error relative to it.


                The code fails at first attempt of Component.getInstance();


                I'm confused because everything seems fine.


                In my application, I use servlets as external services that access internal service session ejbs. In the case of a servlet, the seam context is declared with :



                <web:context-filter url-pattern="*.php" />
                



                in components.xml.


                In the console, I see that twice:


                Component: org.jboss.seam.web.contextFilter, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.web.ContextFilter
                2009-02-17 12:17:30,233 DEBUG [org.jboss.seam.Component] org.jboss.seam.web.contextFilter.urlPattern=*.php
                



                The 2 urlPatterns are the same. I left it like that in the 2 ears because they have a different context root as defined in application.xml


                in ear 1:



                <module>
                      <web>
                         <web-uri>TicketingServices.war</web-uri>
                         <context-root>/TicketingServices_14_0_0_2</context-root>
                      </web>
                   </module>
                



                in ear 2:


                <module>
                      <web>
                         <web-uri>TicketingServices.war</web-uri>
                         <context-root>/TicketingServices_14_0_0_3</context-root>
                      </web>
                   </module>




                Do they need to have different web-uri ?