2 Replies Latest reply on Feb 4, 2009 4:08 PM by zmicer harachka

    JavaBean with SESSION scope serialization-deserialization in tomcat issues: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application

    zmicer harachka Newbie

      Hi, All!


      I have the following issue with seam. I would appreciate if someone point me to the roots of problem. I am rather novice in seam - thus it may appear this is not a problem but lacks of my understanding of concepts of seam. Then - in advance - sorry for silly question.


      I have the following JavaBean:



      @Name("searchResultsCash")
      @Scope(ScopeType.SESSION)
      @AutoCreate
      public class SearchResultsCache implements Serializable {
      



      And when I make restart of my tomcat server - I have the following exception




      04.02.2009 10:29:46 org.apache.catalina.session.StandardSession activate
      SEVERE: Session attribute event listener threw exception
      java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
              at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
              at org.jboss.seam.contexts.Lifecycle.mockApplication(Lifecycle.java:111)
              at org.jboss.seam.Seam.componentForName(Seam.java:298)
              at org.jboss.seam.intercept.RootInterceptor.getComponent(RootInterceptor.java:224)
              at org.jboss.seam.intercept.JavaBeanInterceptor.callPostActivate(JavaBeanInterceptor.java:151)
              at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:72)
              at search.action.SearchResultsCache$$javassist1.sessionDidActivate(SearchResultsCache$$javassist1.java)
              at org.apache.catalina.session.StandardSession.activate(StandardSession.java:816)
              at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:397)
              at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
              at org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
              at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271)
              at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
              at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
              at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
              at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
              at org.apache.catalina.core.StandardService.start(StandardService.java:516)
              at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
              at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
              at java.lang.reflect.Method.invoke(Unknown Source)
              at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
              at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


      It is seen the following
      search.action.SearchResultsCache$$javassist1.sessionDidActivate(SearchResultsCache$$javassist1.java)


      So in the case this is session bean - it has built in through javassist session listeners - which gets event form tomcat servlet container.


      But the issue - is it Seam issue or something special should be configured.



      I use tomcat 6.0 and seam 2.1.0.GA


      Thanks in advance for reading and answering on that item.


      Zmicer
      http://www.zmicer.com

        • 2. Re: JavaBean with SESSION scope serialization-deserialization in tomcat issues: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
          zmicer harachka Newbie

          Thomas, thanks for this tip. I think this issue of tomcat relates to the trace I have provided.


          I have tried to debug SeamListener and could see that exception appeared before calling of



             public void contextInitialized(ServletContextEvent event) 
             {
                log.info( "Welcome to Seam " + Seam.getVersion() );
                ServletLifecycle.beginApplication( event.getServletContext() );
                new Initialization( event.getServletContext() ).create().init();
             }
          



          So that means sessionDidActivate is called before - somewhere at tomcat bootstrapping



               at org.jboss.seam.example.jpa.HotelSearchingAction$$javassist3.sessionDidActivate(HotelSearchingAction$$javassist3.java)
               at org.apache.catalina.session.StandardSession.activate(StandardSession.java:816)
               at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:397)
               at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
               at org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
               at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:438)
               at org.apache.catalina.core.StandardContext.start(StandardContext.java:4271)
               at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
               at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
               at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
               at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
               at org.apache.catalina.core.StandardService.start(StandardService.java:516)
               at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
               at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
               at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


          The most interesting thing is I use tomcat 6.0.18 - one release after the version to where fix mentioned in the link you have provided should have been committed.


          Hopely this exception doesn't ruins application - still it is unpleasant to see in log file.


          Dzmitry