EJB3.0 Serializing a handle to a Stateful Bean

前端 未结 2 1351
后悔当初
后悔当初 2021-01-27 03:24

I\'m attempting to persist the remote handle to a Stateful EJB3.0 bean. This bean\'s interface is defined:

@Remote
public interface Hello extends Serializable {
         


        
相关标签:
2条回答
  • 2021-01-27 03:41

    getEJBObject is not usable with the EJB 3.0 programming model. You'll need to use @RemoteHome and implement EJBHome/EJBObject.

    0 讨论(0)
  • 2021-01-27 03:43

    This exception doesn't seem related to serialization problem. From J2EE API Reference you can read:

    IllegalStateException - Thrown if the instance invokes this method while the instance is in a state that does not allow the instance to invoke this method, or if the instance does not have a remote interface.

    and more :

    An instance of a session enterprise Bean can call this method at anytime between the PostConstruct or ejbCreate and the PreDestroy or ejbRemove methods, including from within these methods.

    It could be that you call getHandle method in a phase where you cannot use getEjbMethod. Maybe something goes wrong with your Session initialization (I suppose that ctx attribute is inizialized somewhere in the code you have omitted for simplicity)

    0 讨论(0)
提交回复
热议问题