7 Replies Latest reply on Sep 24, 2007 1:00 PM by Francisco Antônio

    1.2.1->2.0.0 migration: No active application scope

    steve tynor Novice

      JBoss AS 4.2.1, Seam 2.0.0.CR1

      I'm in the midst of migrating my Seam 1.2.1-based app to 2.0 and _almost_ have it working. However, the first time I access my login page, I get the following error. Debugging this, it is due to the richfaces lib attempting to load "css/toolBar.xcss/DATB/eAFbfzHtOAAGxgKu".

      I've replaced all my jars with the 2.0 seamgen jars, adjusted my faces-config.xml, components.xml, etc. web.xml to look like the 2.0 seamgen (with the namespaces adjusted to correct for broken URL's (j2ee vs. javaee -- http://jira.jboss.org/jira/browse/JBSEAM-1927) in the seamgen'd web.xml), so I think all the servlet filters are set up the same as in seamgen, yet...

      When _should_ the applicationContext have been initialized? What can I do to debug this?

      Thanks!


      2007-09-20 11:49:57,718 INFO [STDOUT] ERROR 2007-09-20 11:49:57,625 [http-127.0.0.1-8080-1] org.ajax4jsf.resource.ResourceLifecycle.send(168) - Exception in PhaseListener, render view : beforePhase
      java.lang.IllegalStateException: No active application scope
       at org.jboss.seam.core.Init.instance(Init.java:75)
       at org.jboss.seam.navigation.Pages.isDebugPage(Pages.java:1510)
       at org.jboss.seam.debug.jsf.SeamDebugPhaseListener.beforePhase(SeamDebugPhaseListener.java:36)
       at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:165)
       at org.ajax4jsf.resource.InternetResourceService.load(InternetResourceService.java:336)
       at org.ajax4jsf.cache.LRUMapCache.load(LRUMapCache.java:116)
       at org.ajax4jsf.cache.LRUMapCache.get(LRUMapCache.java:87)
       at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:198)
       at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:144)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:265)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:543)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)
      



        • 1. Re: 1.2.1->2.0.0 migration: No active application scope
          steve tynor Novice

           

          When _should_ the applicationContext have been initialized? What can I do to debug this?


          Help! I've compared my new config to 2.0.0.CR1-seamgen-produced examples, and the booking example and I can't find anything in my configuration to explain this. To be clear, this was a working application in Seam 1.2.1 - all I've done is follow the migration cookbook to migrate to the new 2.0.0 jars and configuration files.

          Debugging the absence of something (applicationContext is null) is hard - without understanding where it sould have been set, I'm just making wild stabs in the dark. Can someone help me understand when an applicationContext should have been set? I've set breakpoints on the various places where I see Contexts.applicationContext.set() being called (eg. Lifecycle.beginCall(), FacesLifecycle.beginRequest(), ServletLifecycle.beginRequest()).

          I hit the following breakpoints before the "no active application scope" exception:
          <start server>
          ServletLifecycle.beginInitialization()
          ServletLifecycle.endInitialization()
          Lifecycle.mockApplication()
          Lifecycle.unmockApplication()
           <browse to http://localhost:8080/myproject>
          FacesLifecycle.beginRequest()
          Lifecycle.beginSession()
          FacesLifecycle.endRequest()
          FacesLifecycle.beginRequest()
          FacesLifecycle.endRequest()
          FacesLifecycle.beginRequest()
          FacesLifecycle.endRequest()
           <exception happens now -- applicationContext is null>
          



          • 2. Re: 1.2.1->2.0.0 migration: No active application scope
            steve tynor Novice

            I've fixed this by changing my pages.xml configuration. A wildcard that worked in 1.2.1 no longer works in 2.0.0. On reflection, perhaps it never should have worked, but for the sake of the archives, here's what caused the problem:

            In my app, I need _all_ application pages to be password protected -- so I had this in my pages.xml:

            <page view-id="*" login-required="true">
             <navigation>
             <rule if-outcome="home">
             <redirect view-id="/home.xhtml"/>
             </rule>
             </navigation>
             </page>
            


            I'm guessing that the problem is a chicken-egg thing with /login.xhtml (which is conceptually covered by the above wildcard). In 1.2.1, this worked. In 2.0.0, I get the "no active application scope" exception detailed earlier in this thread.

            So my fix is to move all my password-protected pages into subdirectories and leave only the non-protected stuff in the root view. pages.xml no longer has a "*" wildcard, only "/foo/*", "/bar/*", etc.


            • 3. Re: 1.2.1->2.0.0 migration: No active application scope
              Francisco Antônio Newbie

              Hi all.

              In 1.2.1, this worked. In 2.0.0, I get the "no active application scope" exception detailed earlier in this thread.


              In fact ...

              <pages xmlns="http://jboss.com/products/seam/pages"
              ...
              <page view-id="*" login-required="true">
              


              ... was working in Seam 2.0.0.Beta1 but stopped working in 2.0.0.CR1.

              I was getting
              ERROR [ResourceLifecycle] Exception in PhaseListener, render view : beforePhase java.lang.IllegalStateException: No active application scope

              and

              ERROR [ResourceLifecycle] Exception in PhaseListener, render view : beforePhase
              java.lang.IllegalStateException: No application context active


              My solution was to use <page view-id="*"> instead of <page view-id="*" login-required="true"> in pages.xml and to use login-required="true" in all my *.page.xml

              Cheers,
              Francisco Antônio
              "Although nobody can come back and make a new start, anyone can start now and make a new end." (Chico Xavier, Brazil's most famous medium)

              • 4. Re: 1.2.1->2.0.0 migration: No active application scope
                Alex Ka Novice

                Shouldn't you post a JIRA request if you consider it a bug?

                In our application we use "/foo/*", "/bar/*", etc. so we don't have your problem. But I can imagine a case where I would put a login-required=true on all (*) and then login-required=false on the specific pages that can be accessed anonymously, eg.: login

                • 5. Re: 1.2.1->2.0.0 migration: No active application scope
                  Francisco Antônio Newbie

                  Hi wise_guybg.

                  Although I have said "...was working in Seam 2.0.0.Beta1 but stopped working in 2.0.0.CR1." I'm not sure the issue is a bug or a redesign. I'll let the answer to the framework developers.

                  Thanks.
                  Francisco Antônio.

                  • 6. Re: 1.2.1->2.0.0 migration: No active application scope
                    Matt Drees Master

                    I think the developers would appreciate a jira. They can always close it if they feel it's not a bug. (Though in this case, I'm fairly certain it is).

                    • 7. Re: 1.2.1->2.0.0 migration: No active application scope
                      Francisco Antônio Newbie

                      Yeah, you are right, matt.drees.

                      Here it is:
                      http://jira.jboss.org/jira/browse/JBSEAM-1959

                      Francisco Antônio
                      "The biggest weapon against stress is our ability to choose a thought instead of another one." (WILLIAM JAMES)