users@glassfish.java.net

Testing stateful session _at_prePassivate and _at_postActivate in Glassfish v3

From: <glassfish_at_javadesktop.org>
Date: Thu, 23 Sep 2010 15:06:03 PDT

I am trying to test the @prePassivate and @postActivate callback methods in glassfish v3 using a stateful sesssion bean. I've attached the example I am using from polarsparc.com. There is also a CustomClock.java remote interface that I am not able to attach.

The only way I am able to get glassfish to store the stateful bean to the local disk is if I reset or stop the server. If I use @StatefulTimeout(1) the @prePassivate callback method is invoked after a minute but nothing is written to the local disk, @postActivate is never called, and when I try to restore the session the program crashes.

[u][b]Here is the error message:[/b][/u]

javax.ejb.NoSuchEJBException
        at cart.ejb._Cart_Wrapper.getTime(cart/ejb/_Cart_Wrapper.java)
        at cart.client.CartClient.main(CartClient.java:35)
        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:597)
        at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:424)
        at org.glassfish.appclient.client.AppClientFacade.launch(AppClientFacade.java:151)
        at org.glassfish.appclient.client.AppClientGroupFacade.main(AppClientGroupFacade.java:64)
Caused by: java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 9999 No; nested exception is:
        org.omg.CORBA.OBJECT_NOT_EXIST: ----------BEGIN server-side stack trace----------
org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: 0x2000 minor code: 1807 completed: No
        at org.glassfish.enterprise.iiop.impl.POARemoteReferenceFactory.preinvoke(POARemoteReferenceFactory.java:523)
        at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorImpl_NR_USM.internalGetServant(POAPolicyMediatorImpl_NR_USM.java:93)
        at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorBase.getInvocationServant(POAPolicyMediatorBase.java:127)
        at com.sun.corba.ee.impl.oa.poa.POAImpl.getInvocationServant(POAImpl.java:1822)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServant(CorbaServerRequestDispatcherImpl.java:341)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:375)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:213)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)

----------END server-side stack trace---------- vmcid: 0x2000 minor code: 1807 completed: No
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:280)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:200)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:147)
        at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:225)
        at cart.ejb.__Cart_Remote_DynamicStub.getTime(cart/ejb/__Cart_Remote_DynamicStub.java)
        ... 9 more
Caused by: org.omg.CORBA.OBJECT_NOT_EXIST: ----------BEGIN server-side stack trace----------
org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: 0x2000 minor code: 1807 completed: No
        at org.glassfish.enterprise.iiop.impl.POARemoteReferenceFactory.preinvoke(POARemoteReferenceFactory.java:523)
        at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorImpl_NR_USM.internalGetServant(POAPolicyMediatorImpl_NR_USM.java:93)
        at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorBase.getInvocationServant(POAPolicyMediatorBase.java:127)
        at com.sun.corba.ee.impl.oa.poa.POAImpl.getInvocationServant(POAImpl.java:1822)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServant(CorbaServerRequestDispatcherImpl.java:341)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:375)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:213)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)

----------END server-side stack trace---------- vmcid: 0x2000 minor code: 1807 completed: No
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:913)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:129)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:681)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:510)
        at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:369)
        at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:235)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:187)
        ... 12 more

[u][b]Here is the server.log:[/b][/u]

SEVERE: NRU-cart.ejb.CartBean: Cannot load from BACKUPSTORE FOR Key: <190c06800a81f-4088f953-0>
SEVERE: iiop.gettie_exception
javax.ejb.NoSuchObjectLocalException: Invalid Session Key ( 190c06800a81f-4088f953-0)
        at com.sun.ejb.containers.StatefulSessionContainer._getContextForInstance(StatefulSessionContainer.java:1269)
        at com.sun.ejb.containers.StatefulSessionContainer.getEJBRemoteBusinessObjectImpl(StatefulSessionContainer.java:1293)
        at com.sun.ejb.containers.BaseContainer.getTargetObject(BaseContainer.java:1721)
        at org.glassfish.enterprise.iiop.impl.POARemoteReferenceFactory.preinvoke(POARemoteReferenceFactory.java:498)
        at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorImpl_NR_USM.internalGetServant(POAPolicyMediatorImpl_NR_USM.java:93)
        at com.sun.corba.ee.impl.oa.poa.POAPolicyMediatorBase.getInvocationServant(POAPolicyMediatorBase.java:127)
        at com.sun.corba.ee.impl.oa.poa.POAImpl.getInvocationServant(POAImpl.java:1822)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServant(CorbaServerRequestDispatcherImpl.java:341)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:375)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:213)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1841)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1695)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1078)
        at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:221)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:797)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:561)
        at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2558)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.performWork(ThreadPoolImpl.java:492)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:528)
[Message sent by forum member 'jcode7463']

http://forums.java.net/jive/thread.jspa?messageID=483560