I am working on jboss-as-7.1.3.Final and want to access the Handle of a StatefulSessionBean:
<code>
@Stateful
@Remote(Session.class)
public class SessionBean implements Session {
@Resource
SessionContext sessionContext;
public Handle getHandle() throws Exception {
return sessionContext.getEJBObject().getHandle();
}
}
<code>
But invocation gives:
Caused by: java.lang.IllegalStateException: JBAS014354: Bean SessionBean hat kein EJBObject
at org.jboss.as.ejb3.component.stateful.StatefulSessionComponent.getEJBObject(StatefulSessionComponent.java:202) [jboss-as-ejb3-7.1.3.Final.jar:7.1.3.Final]
at org.jboss.as.ejb3.context.SessionContextImpl.getEJBObject(SessionContextImpl.java:76) [jboss-as-ejb3-7.1.3.Final.jar:7.1.3.Final]
at at.tfr.test.SessionBean.getHandle(SessionBean.java:21) [classes:]
Can you please explain, what is wrong?