ejb@glassfish.java.net

Re: Holder Class Error

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Mon, 26 Jun 2006 10:59:41 -0400

Ning Zhu wrote:

>So, in ejb 3.0, we still only support pass by value (serialization), we do
>not support pass by proxy; which mean there is no way a parameter can be out
>or inout.
>
For the Remote EJB view, both 2.x and 3.0, all parameters and return
values are pass-by-value, even if the caller and target happen to be
collocated in the same JVM.

>Am I right here? If not, please provide a sample of out or inout parameters
>for ejb using remote interface.
>
The simplest thing is just to pass the boolean as a return value or
write your own holder class. Just set the value in the ejb and it will
be seen by the client. E.g.

public class MyBooleanHolder implements java.io.Serializable {
boolean value;
}


>
>Thanks,
>Ning
>
>-----Original Message-----
>From: Ken.Cavanaugh_at_Sun.COM [mailto:Ken.Cavanaugh_at_Sun.COM]
>Sent: Thursday, June 22, 2006 5:57 PM
>To: Ning Zhu
>Cc: Kenneth.Saks_at_Sun.COM; corba-dev_at_Sun.COM; ejb_at_glassfish.dev.java.net
>Subject: Re: Holder Class Error
>
>
>Ning Zhu wrote:
>
>
>>Here is the stack tracing:
>>
>>java.lang.ClassCastException: org.omg.CORBA.BooleanHolder
>> at
>>
>>
>>
>com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.write(
>
>
>>DynamicMethodMarshallerImpl.java:338)
>> at
>>
>>
>>
>com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.writeArgu
>
>
>>ments(DynamicMethodMarshallerImpl.java:407)
>> at
>>
>>
>>
>com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvo
>
>
>>ke(StubInvocationHandlerImpl.java:157)
>> at
>>
>>
>>
>com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(Stub
>
>
>>InvocationHandlerImpl.java:119)
>> at
>>
>>
>>
>com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase
>
>
>>.java:197)
>> at
>>
>>
>>
>asp.dorp.__Content_Remote_DynamicStub.getContentbyID(__Content_Remote_Dynami
>
>
>>cStub.java)
>> at
>>asp.dorp._Content_Wrapper.getContentbyID(asp.dorp._Content_Wrapper.java)
>> at test.Main.main(Main.java:33)
>>
>>
>>
>>
>Do NOT use BooleanHolder here. BooleanHolder is not Serializable, and so
>it is not
>an RMI-IIOP value type. BooleanHolder (and all of the other
>org.omg.*Holder classes)
>are present for handling IDL out parameters, and cannot be used with
>RMI-IIOP.
>The ClassCastException occurs because the ORB code must cast the value to
>Serializable.
>
>To return a boolean result, you should either use a boolean[], or a
>simple Serializable
>wrapper class.
>
>Ken.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>
>
>