5 Replies Latest reply on Nov 12, 2003 8:52 AM by alexst1

    java.rmi.NoSuchObjectException: Could not activate; failed t

    hary

      Hi,
      I get the following exception when multiple clients access a stateful session bean.
      java.rmi.NoSuchObjectException: Could not activate; failed to restore state; CausedByException is:
      D:\work\evals\jboss-3.2.2RC4\server\default\tmp\sessions\CsrCreate-dl7zrfxx-3\dl7ztujs-1z.ser (The system cannot find the file specified)
      at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:122)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:210)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatefulSessionContainer.internalInvoke(StatefulSessionContainer.java:416)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
      at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)


      This only happens when two clients connect at the same time.
      I'm using jboss 3.2.2RC4

      I'm new to EJB and jBoss. This may well be something I'm causing. Would appreciate any pointers.

        • 1. Re: java.rmi.NoSuchObjectException: Could not activate; fail
          milowe

          The bean you are trying to access has been removed.
          Your interface refers to bean that doesnt exist any more.

          /micke

          • 2. Re: java.rmi.NoSuchObjectException: Could not activate; fail

            Only one client is allowed to access a stateful session
            bean concurrently.
            Breaking that rule will lead to a system exception which
            will discard the bean.

            Regards,
            Adrian

            • 3. Re: java.rmi.NoSuchObjectException: Could not activate; fail
              hary

              Unfortunately both the points above don't seem to match my case.
              I am only runing a test client. The sessions are being created separately by each client (its a command line test program I wrote and each client is a separate process). And since I was lazy with the test client I was not removing the beans after use. There is no other code that accesses this bean either. So I think its unlikely that the bean has been removed either. (Is there a way to check whether it is removed? perhaps through the console?)

              • 4. Re: java.rmi.NoSuchObjectException: Could not activate; fail
                hary

                I think I found the problem:

                I see the following in the logs
                2003-10-01 09:48:37,997 DEBUG [org.jboss.ejb.plugins.TxInterceptorCMT] Application deadlock detected, resource=org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock@1d41dc3, bean=Subscriber, id=f7f5de6fe3-91bf02-8a, refs=2, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=hary//577, BranchQual=], synched=Thread[RMI TCP Connection(6)-192.168.1.101,5,RMI Runtime], timeout=5000, queue=[], holder=TransactionImpl:XidImpl [FormatId=257, GlobalId=hary//575, BranchQual=], waitingResource=org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock@ee1626, bean=Location, id=bangalore, refs=2, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=hary//575, BranchQual=], synched=null, timeout=5000, queue=[TXLOCK waitingTx=TransactionImpl:XidImpl [FormatId=257, GlobalId=hary//577, BranchQual=] id=0 thread=Thread[RMI TCP Connection(5)-192.168.1.101,5,RMI Runtime] queued=true], waitingResourceHolder=TransactionImpl:XidImpl [FormatId=257, GlobalId=hary//575, BranchQual=] retrying 1

                I din't notice it since it showed only in the logs.
                Running on 3.2.1 this showed as an error (though with less details.)

                Would appreciate any pointers to identify which objects are involved in this.

                • 5. Re: java.rmi.NoSuchObjectException: Could not activate; fail
                  alexst1

                  "Application deadlock detected" - this is the key. Your "CsrCreate" EJB has to scpecify the correct transaction requirement.
                  In your ejb-jar.xml put something like this in the <assembly-descriptor> section:

                  <container-transaction >

                  <ejb-name>CsrCreate</ejb-name>
                  <method-name>*</method-name>

                  <trans-attribute>RequiresNew</trans-attribute>
                  </container-transaction>

                  or as XDoclet

                  /**
                  * @ejb.transaction type = "RequiresNew"
                  */


                  "RequiresNew" is the transaction requirement.
                  Have a look at http://www.javacaps.com/ejb/ejb_transactions.html for info on transactions.

                  In any case, this was the solution for when I had similar errors.