I want to save a link to a session with Bean state and save it in the database or transfer it to another virtual machine. As far as I read, in EJB 2.x this is possible with getHandle(). If I try to serialize an SFSB instance using Glassfish 3.1.1, I get the following exception:
java.io.NotSerializableException: com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate
Also, I did not find a way to get the SFSB descriptor. All references in the SFSB SessionContext to EFBHome, EFBObject, EFBLocalHome are equal to zero, even if the Bean is controlled by the container. If I understand the specification correctly, in any case there should be no need for pens in EJB 3.1, because developers should be able to directly use the SFSB link.
This article discusses the same issue, but the proposed use of the JavaEEObjectInputStream class did not reveal the readObject method in my tests. I wonder how this approach can ever work.
Can someone suggest a good approach to serializing SFSB in Glassfish to keep the link? I donβt want to put a link to HTTPSession (I just say this because people recommend it everywhere).
source
share