6 Replies Latest reply on May 14, 2007 4:44 AM by sradford

    javax.ejb.EJBNoSuchObjectException

    sradford

      Hi,

      In the last couple of days we've started seeing EJBNoSuchObjectExceptions happening and cannot work out why. I note a bunch of JIRA issues relating to this, but they are all marked as resolved, and as we are using the latest version of Seam think it must be something else.

      In the below stacktrace, the session bean has the following annotations:

      @Name("mySessionBean")
      @Scope(ScopeType.EVENT)
      @Stateful(name = "mySessionBean")
      @Restrict("#{s:hasPermission('admin','search',null)}")

      Any ideas?

      Thanks and regards,

      Sean

      09:52:22,211 WARN [Contexts] Could not destroy component: mySessionBean
      javax.ejb.EJBNoSuchObjectException: Could not find Stateful bean: a1ti30-dry6bf-f1ketavl-1-f1kevak9-10
      at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:268)
      at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.removeSession(StatefulRemoveInterceptor.java:127)
      at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:87)
      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:102)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      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:203)
      at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
      at $Proxy323.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:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
      at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
      at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
      at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
      at org.javassist.tmp.java.lang.Object_$$_javassist_40.destroy(Object_$$_javassist_40.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:585)
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
      at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
      at org.jboss.seam.Component.callDestroyMethod(Component.java:1765)
      at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:231)
      at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:439)
      at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:315)
      at org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRender(AbstractSeamPhaseListener.java:256)
      at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:115)
      at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
      at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
      at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
      at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)

        • 1. Re: javax.ejb.EJBNoSuchObjectException
          stu2

          Btw, what's the point of having an event scoped SFSB? SFSB's strength is statefulness across requests, which is why they default to conversational scope.

          Just curious.

          • 2. Re: javax.ejb.EJBNoSuchObjectException
            sradford

            So that during the processing of the event (request) the SessionBean maintains its state across method calls made to it.

            • 3. Re: javax.ejb.EJBNoSuchObjectException
              stu2

              You'd get the same behavior by just using a pojo. They're event-scoped by default for that reason. Using a SFSB that way certainly works, but if you look at the interceptor stack, there's definitly more overhead when using a SFSB as a pojo.

              • 4. Re: javax.ejb.EJBNoSuchObjectException
                sradford

                True, but...

                However, they [POJOs] do not provide the functionality of a session bean (declarative transaction demarcation, declarative security, efficient clustered state replication, EJB 3.0 persistence, timeout methods, etc).

                (taken from 3.2.4 of the Seam doc)

                • 5. Re: javax.ejb.EJBNoSuchObjectException
                  stu2

                   

                  "sradford" wrote:
                  True, but...

                  However, they [POJOs] do not provide the functionality of a session bean (declarative transaction demarcation, declarative security, efficient clustered state replication, EJB 3.0 persistence, timeout methods, etc).

                  (taken from 3.2.4 of the Seam doc)


                  Sorry to hijack your thread btw. I've seen the error you're asking about before, and am curious about it myself. Hopefully this topic shift will keep the post at the top of the list and get attention of one of the Seam guys.

                  Back to pojos vs SFSB scoped to events though. In event scope, several of the features you identified don't apply to event scope (replication, timeouts). In Seam the rest of the items in that list are handled by seam as an abstraction of the container. For instance the recommended useage pattern for seam is to use Seam Managed Persistence Contexts (section 8.3 in the docs) which work equally well with pojos, and there are lots of examples in the seam source. Security is interceptor based as well, and SFSB offer no advantages I'm aware of. I believe you have to call em.joinTransaction() from a pojo (automatic from a SFSB).

                  Anyway, no biggie, but an interesting question. If anyone has anything to add regarding pros and cons of pojos/SFSB in this scenario I'd be interested to hear. I've been using SFSB only when there is multi-request conversational state.

                  • 6. Re: javax.ejb.EJBNoSuchObjectException
                    sradford

                    So would one say that the declarative transaction handling is a good reason to use a SessionBean over a POJO during an event scoped process?