User development,
A new message was posted in the thread "How do I enable pass-by-reference for EJB3 in
JBoss AS container?":
http://community.jboss.org/message/524219#524219
Author : Jerry Simone
Profile :
http://community.jboss.org/people/jlsimone
Message:
--------------------------------------------------------------
Here is some new/additional information and a more concrete example.
I wrote a small, simple-minded application to test solutions to these types of problems.
Please excuse the silly names. I have a stateful EJB named HatBean. The HatBean has a
getHatCleaner()method that it uses to get a reference to (the remote interface for) the
stateful HatCleanerBean. The last line of the stack trace below shows the call to the
HatBean method getHatCleaner(). Once the HatBean has the remote interface for the
HatCleanerBean, the HatBean uses that remote interface to initialize the state of the
HatCleanerBean by calling the initialize() method on the HatCleanerBean, passing it
objects that will be retained in the state of the HatCleanerBean. (This initialize()
method is my own hack that I use, having only recently learned about the @Init annotation
for the EJB3 beans.) Anyway, this stack trace seems to indicate that the container is
serializing the objects that are being passed to the HatCleanerBean. One of the objects
passed to the HatCleanerBean.initialize() method is the HatCleanerProcessor. I
deliberately did not make the HatCleanerProcessor serializable because I want the
HatCleanerProcessor to be passed by reference to the HatCleanerBean, bypassing
serialization for calls within the same JVM. I see interesting things in the stack trace
like MarshalledObjectForLocalCalls which makes me think that the container recognizes the
local nature of the call. But further up in the stack trace is a reference to a
StatefulRemoteInvocation which suggests remote rather than local interactions. The
question remains, that is, is there a way to get the JBoss 5.1 EJB container to quit
trying to serialize objects across a local call to an EJB?
Caused by: java.io.NotSerializableException:
com.swa.hat.server.domain.HatCleanerProcessor
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at java.rmi.MarshalledObject.<init>(MarshalledObject.java:101)
at org.jboss.aop.joinpoint.MethodInvocation.writeExternal(MethodInvocation.java:373)
at
org.jboss.ejb3.proxy.impl.invocation.StatefulRemoteInvocation.writeExternal(StatefulRemoteInvocation.java:78)
at
org.jboss.serial.persister.ExternalizePersister.writeData(ExternalizePersister.java:58)
at
org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
at
org.jboss.serial.objectmetamodel.DataContainer$DataContainerOutput.writeObject(DataContainer.java:390)
at
org.jboss.serial.io.MarshalledObjectForLocalCalls.<init>(MarshalledObjectForLocalCalls.java:38)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:79)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
at $Proxy268.invoke(Unknown Source)
at
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
at
org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
at $Proxy255.initialize(Unknown Source)
at com.swa.hat.ejb.HatBean.getHatCleaner(HatBean.java:45)
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/524219#524219