Resolution: Works as designed
Affects Version/s: 126.96.36.199
Fix Version/s: None
Windows 32bit, java 6
When calling SessionContext.getEJBObject().getHandle(); inside a method in a stateful session bean, the server throws java.lang.IllegalStateException: EJBObject not available
I think that the server should allow to access handle to a stateful session bean even if it's EJB 3-like implementation. Spec is not clear about this so I'd assume the backward compatibility. I am attaching example application.
In my opinion it's against the javadoc
Obtain a reference to the EJB object that is currently associated with the instance.
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.
An instance can use this method, for example, when it wants to pass a reference to itself in a method argument or result.