users@glassfish.java.net

Re: GF v3: Singleton pass by reference problem

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 Apr 2010 02:21:03 PDT

But when I try to use it like this:
------------------------------------------------
@Stateful
public class EJB01Bean implements EJB01, EJB01Local{
    @EJB Manager manager;
    @Resource SessionContext ctx;
    public void init() {
        EJB01Local obj=ctx.getBusinessObject(EJB01Local.class);
        // /*or*/ EJB01 obj=ctx.getBusinessObject(EJB01.class);
        if (obj ==null) Logger.getLogger(getClass().getName()).severe("obj is null");
        else manager.register("EJB01", obj);
    }
    public void method1(int i) {
        Logger.getLogger(getClass().getName()).severe("method1 i=="+i);
    }
    public void remoteMethod(){
        Logger.getLogger(getClass().getName()).severe("RemoteMethod called.");
    }
    public void notRemoteMethod(){
        Logger.getLogger(getClass().getName()).severe("notRemoteMethod called.");
    }
}
_______________________________________________
Some times it works fine but some times it gives me:
[#|2010-04-14T13:03:09.154+0400|WARNING|glassfishv3.0|javax.enterprise.resource.corba.ee.S1AS-ORB.rpc.encoding|_ThreadID=30;_ThreadName=Thread-1;|"IOP0081021
1: (MARSHAL) Exception from readValue on ValueHandler in CDRInputStream"
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 211 completed: Maybe
        at com.sun.corba.ee.impl.logging.ORBUtilSystemException.valuehandlerReadException(ORBUtilSystemException.java:8888)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1076)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1175)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:986)
        at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:646)
        at com.sun.corba.ee.impl.corba.TCUtility.unmarshalIn(TCUtility.java:286)
        at com.sun.corba.ee.impl.corba.AnyImpl.read_value(AnyImpl.java:611)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_any(CDRInputStream_1_0.java:829)
        at com.sun.corba.ee.impl.encoding.CDRInputObject.read_any(CDRInputObject.java:583)
        at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.readAny(Util.java:461)
        at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$10.read(DynamicMethodMarshallerImpl.java:292)
        at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readResult(DynamicMethodMarshallerImpl.java:484)
        at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:190)
        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 test.__Manager_Remote_DynamicStub.get(test/__Manager_Remote_DynamicStub.java)
        at test._Manager_Wrapper.get(test/_Manager_Wrapper.java)
        at test.EJB02Bean.method2(EJB02Bean.java:25)
        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 org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
        at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
        at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:4038)
        at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5223)
        at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5203)
        at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:201)
        at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:75)
        at $Proxy157.method2(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 com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie.dispatchToMethod(ReflectiveTie.java:146)
        at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:176)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:682)
        at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:216)
        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)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.sun.corba.ee.impl.io.ObjectStreamClass.readResolve(ObjectStreamClass.java:350)
        at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:452)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:364)
        at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:320)
        at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1066)
        ... 45 more
Caused by: java.lang.reflect.InvocationTargetException
        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 com.sun.corba.ee.impl.io.ObjectStreamClass.readResolve(ObjectStreamClass.java:348)
        ... 49 more
Caused by: java.lang.IllegalStateException: Can't overwrite cause
        at java.lang.Throwable.initCause(Throwable.java:320)
        at com.sun.ejb.containers.RemoteBusinessWrapperBase.readResolve(RemoteBusinessWrapperBase.java:139)
        ... 54 more
|#]
[Message sent by forum member 'lft']

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