1 Reply Latest reply on Apr 21, 2010 7:24 AM by Arbi Sookazian

    Destroying a Seam component

    Arbi Sookazian Master

      I am seeing the following while testing my Seam 2.x app with JRebel 3.0.1.  I'm wondering what the recommendation was in Seam 2 in terms of using @Remove which is EJB-specific with @Destroy which is Seam-specific and what changes to this, if any, will be made in Seam 3.  It seems to me you should use one or the other depending on if the component is an EJB or JavaBean.  Should never use both?


      22:08:19,829 INFO  [STDOUT] JRebel: Reloading class 'com.echo.cis.ejb.seam.statementmessage.TestJRebel'.
      22:08:19,845 INFO  [STDOUT] JRebel: Reloading class 'org.javassist.tmp.java.lang.Object_$$_javassist_7'.
      22:08:19,860 INFO  [STDOUT] JRebel: Reinitialized class 'org.javassist.tmp.java.lang.Object_$$_javassist_7'.
      22:08:19,860 INFO  [STDOUT] TestJRebelAction: in submit2()
      22:08:19,985 INFO  [STDOUT] TestJRebelAction: in destroy()
      22:08:19,985 WARN  [Component] Exception calling stateful session bean default @Remove method: testJRebel
      javax.ejb.NoSuchEJBException: Could not find stateful bean: 4si4k5i-5xywf8-g89ojnfl-1-g89onrw5-25
           at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:390)
           at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:375)
           at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:61)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:97)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
           at $Proxy407.destroy(Unknown Source)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:592)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:43)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
           at org.javassist.tmp.java.lang.Object_$$_javassist_7$$M$aa27531e.destroy(Object_$$_javassist_7.java)
           at org.javassist.tmp.java.lang.Object_$$_javassist_7$$A$aa27531e.destroy(<generated>)
           at org.javassist.tmp.java.lang.Object_$$_javassist_7.destroy(Object_$$_javassist_7.java)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:592)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2211)
           at org.jboss.seam.Component.callDefaultRemoveMethod(Component.java:2116)
           at org.jboss.seam.Component.destroy(Component.java:1446)
           at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:251)
           at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:363)
           at org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:129)
           at org.jboss.seam.jsf.SeamPhaseListener.afterRenderResponse(SeamPhaseListener.java:515)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:247)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           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:368)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
           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.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 com.echo.cis.web.filters.TimingFilter.doFilter(TimingFilter.java:61)
           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.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(Thread.java:595)
      

        • 1. Re: Destroying a Seam component
          Arbi Sookazian Master

          Well I removed the @Destroy (assuming JRebel hotdeployed the .class file for the SFSB) and still getting the NoSuchEJBException:


          22:15:43,042 INFO  [STDOUT] TestJRebelAction: in submit2()
          22:15:43,136 INFO  [STDOUT] TestJRebelAction: in destroy()
          22:15:43,136 WARN  [Component] Exception calling stateful session bean default @Remove method: testJRebel
          javax.ejb.NoSuchEJBException: Could not find stateful bean: 4si4k5i-5xywf8-g89ojnfl-1-g89ox9vm-2b



          Most likely the SFSB did not passivate so the Seam container is invoking the destroy() method.


          @Stateful
          @Name("testJRebel")
          public class TestJRebelAction implements TestJRebel {
          
               public void submit() {          
                    System.out.println("TestJRebelAction: in submit()");
               }
               
               public void submit2() {          
                    System.out.println("TestJRebelAction: in submit2()");
               }
               
               @Remove
               public void destroy() {
                    System.out.println("TestJRebelAction: in destroy()");
               }
          }



          So I made the component session-scoped but reproduced the exception.  I did 'mvn clean install' and then redeployed to JBoss and now the exception is gone.


          22:22:50,552 INFO  [STDOUT] JRebel: Reloading class 'com.echo.cis.ejb.seam.statementmessage.TestJRebelAction'.
          22:22:50,568 INFO  [STDOUT] JRebel-JBoss: Reconfiguring EJB 'jboss.j2ee:service=EJB3,name=TestJRebelAction' [com.echo.cis.ejb.seam.statementmessage.TestJRebelAction]
          22:22:50,568 INFO  [STDOUT] JRebel-Seam: Reconfiguring Seam component 'testJRebel' [com.echo.cis.ejb.seam.statementmessage.TestJRebelAction]
          22:22:50,599 INFO  [STDOUT] TestJRebelAction: in submit2()



          So apparently the JRebel is not hot redeploying this:


          @Scope(ScopeType.SESSION)