11 Replies Latest reply on Jun 18, 2010 9:54 AM by shyam HP

    Stateful bean error in Seam 2.1.1 GA and CR2

    Tamas Malatinszki Newbie

      Hi All,


      I have an application that is running on JBoss 4.2.3GA with Seam 2.1.1CR1. After I upgraded it to Seam 2.1.1CR2 it crashed. I tested it with Seam 2.1.1GA, but the situation was the same.
      I'm using a stateful session bean:



      @Startup
      @Stateful
      @Name("hireAction")
      @Scope(ScopeType.SESSION)
      public class HireActionImpl implements HireAction, Serializable {
      
           private static final long serialVersionUID = 9079770581529556775L;
      
           @Logger Log log;
      
           @Create
           public void init(){
           }
           
           @Remove
           @Destroy
           public void destroy() {
           }
           
      }



      The interface is:


      @Local
      public interface HireAction {
      
           public void init();
           public void destroy();
      }



      I'm receiving this error message:


      12:09:24,584 INFO  [Contexts] starting up: hireAction
      12:09:24,615 ERROR [[/directreports]] Session event listener threw exception
      org.jboss.seam.InstantiationException: Could not instantiate Seam component: hireAction
           at org.jboss.seam.Component.newInstance(Component.java:2106)
           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
           at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:209)
           at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:141)
           at org.jboss.seam.servlet.SeamListener.sessionCreated(SeamListener.java:45)
           at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:397)
           at org.apache.catalina.session.StandardSession.setId(StandardSession.java:369)
           at org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:828)
           at org.apache.catalina.session.StandardManager.createSession(StandardManager.java:291)
           at org.apache.catalina.connector.Request.doGetSession(Request.java:2312)
           at org.apache.catalina.connector.Request.getSession(Request.java:2075)
           at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
           at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:844)
           at org.jboss.seam.web.IdentityRequestWrapper.<init>(IdentityRequestWrapper.java:23)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
           at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
           at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           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.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           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:182)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Unknown Source)
      Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: com/flex/directreports/session/HireAction
           at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:190)
           at org.jboss.seam.Component.createProxyFactory(Component.java:2388)
           at org.jboss.seam.Component.getProxyFactory(Component.java:1480)
           at org.jboss.seam.Component.wrap(Component.java:1471)
           at org.jboss.seam.Component.instantiateSessionBean(Component.java:1368)
           at org.jboss.seam.Component.instantiate(Component.java:1331)
           at org.jboss.seam.Component.newInstance(Component.java:2084)
           ... 51 more
      Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: com/flex/directreports/session/HireAction
           at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169)
           at org.jboss.seam.util.ProxyFactory.createClass(ProxyFactory.java:186)
           ... 57 more
      Caused by: java.lang.NoClassDefFoundError: com/flex/directreports/session/HireAction
           at java.lang.ClassLoader.defineClass1(Native Method)
           at java.lang.ClassLoader.defineClass(Unknown Source)
           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 javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181)
           at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163)
           ... 58 more
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.flex.directreports.session.HireAction
           at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
           at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
           at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at java.lang.ClassLoader.loadClassInternal(Unknown Source)
           ... 66 more



      The strange thing is if I'm removing the @Stateful annotation it is working fine with all Seam versions, but with this annotation I'm receiving this error above Seam 2.1.1CR1.
      I checked the list of changes of 2.1.1CR2, but I haven't find anything related to this issue.
      Is there any idea about it?


      Many thanks,
      Tamas



        • 1. Re: Stateful bean error in Seam 2.1.1 GA and CR2
          Tamas Malatinszki Newbie

          Here is the components.xml:


          <?xml version="1.0" encoding="UTF-8"?>
          <components xmlns="http://jboss.com/products/seam/components"
                                  xmlns:core="http://jboss.com/products/seam/core"
                      xmlns:persistence="http://jboss.com/products/seam/persistence"
                      xmlns:security="http://jboss.com/products/seam/security"
                      xmlns:ui="http://jboss.com/products/seam/ui"
                      xmlns:transaction="http://jboss.com/products/seam/transaction"
                      xmlns:mail="http://jboss.com/products/seam/mail"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                  xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
                                                          http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                                                          http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                                                          http://jboss.com/products/seam/ui http://jboss.com/products/seam/ui-2.1.xsd
                                                          http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
                                                          http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd
                                                          http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd">
           
            <core:init debug="true" jndi-pattern="directreports-ear/#{ejbName}/local"/>
            <core:manager concurrent-request-timeout="120000"
                          conversation-timeout="120000"
                          conversation-id-parameter="cid"
                          parent-conversation-id-parameter="pid"/>
          
            <persistence:managed-persistence-context name="em" auto-create="true" persistence-unit-jndi-name="java:/EntityManagerFactories/directreports"/>
            <ui:jpa-entity-loader entity-manager="#{em}"/>
          
          </components>
          


          • 2. Re: Stateful bean error in Seam 2.1.1 GA and CR2
            Stuart Douglas Master

            Can you post your ear layout and application.xml?

            • 3. Re: Stateful bean error in Seam 2.1.1 GA and CR2
              Tamas Malatinszki Newbie

              Here is the application.xml:



              <?xml version="1.0" encoding="UTF-8"?>
              <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xmlns="http://java.sun.com/xml/ns/javaee"
                              xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
                              xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">
                <display-name>directreports-ear</display-name>
                <module>
                  <ejb>directreports-ejb.jar</ejb>
                </module>
                <module>
                  <web>
                    <web-uri>directreports.war</web-uri>
                    <context-root>directreports</context-root>
                  </web>
                </module>
              </application>
              



              And here is my ear layout (sorry for the poor drawing):



              + directreports-ear
                 |
                 \dist
                 |
                 +EarContent
                   |
                   \application.xml
                   \jboss-app.xml
                   \MANIFEST.MF
                 |
                 \resources
              



              And one more thing: I'm storeing the required seam libs in my Jboss's lib directory, but the error is the same if I put them back into the project.

              • 4. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                Tamas Malatinszki Newbie

                Sorry, I forgot to put META-INF directory into the layout, here is the correct one:



                directreports-ear
                |       
                +---dist
                +---EarContent
                |   \---META-INF
                |           application.xml
                |           jboss-app.xml
                |           MANIFEST.MF
                |           
                \---resources




                Thanks,
                Tamas

                • 5. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                  Tamas Malatinszki Newbie

                  Is there any idea about this issue?
                  I tried to test it with one of the nightly builds, but the error was the same. Shall I open a JIRA ticket about it?


                  Thanks,
                  Tamas

                  • 6. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                    Stuart Douglas Master

                    Where is the HireAction interface in regards to the HireActionImpl class? are they in separate jars?


                    One other thing to check, even though it is a long shot is that you have enough permgen space, try increase the space using -XX:MaxPermSize=512m (or some other number) and see if that helps, I have occasionally seen instances where permgen errors are not reported as such, and it could be that the addition of new classes in 2.1.1 is enough to tip you over the edge.

                    • 7. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                      Tamas Malatinszki Newbie

                      The HireAction interface is in the same package as HireActionImpl, once I tried to move it into another package (and into another jar as well), but the error was the same.
                      I checked the mem. settings of JBoss, and tried to change it from 512 to 1024 and 1538 too, but nothing changed.


                      Isn't is possible that after Seam 2.1.1 CR2 I have to register the EJBs in one of the xml files if I want to use them as a seam component?

                      • 8. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                        Stuart Douglas Master

                        This is almost certainly a classloading issue. Can you post jboss-app.xml and verify that you do not have any duplicate versions of any libraries on your classpath?

                        • 9. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                          Stuart Douglas Master

                          JBSEAM-3758 seems to be the only issue in the release notes that could be causing this.

                          • 10. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                            Tamas Malatinszki Newbie

                            I've opened an issue ticket in JIRA, and I uploaded a test application, because they said it must be some kind of packaging issue.


                            In the meanwhile I have found the root cause of this issue, the problem is I keeping my seam-related jars in the lib directory of my JBoss server instead the project, and it seems this way is not working anymore with Seam 2.1.1 CR2 and above.


                            Do You know if is there any way to work with these versions of Seam by keeping these jars in my JBoss's lib directory?

                            • 11. Re: Stateful bean error in Seam 2.1.1 GA and CR2
                              shyam HP Newbie

                              i am getting this Deployment exception please tell me solution