Hi,
I have a stateless session bean with bean-managed transactions. It is throwing an
IllegalStateException when it tries to call:
utx = mySessionCtx.getUserTransaction();
where utx is a javax.transaction.UserTransaction and mySessionCtx is a javax.ejb.SessionContext. The bean is defined as follows:
<session id="Session_1061575773750">
<ejb-name>ReservationManager</ejb-name>
<home>com.bostoncoach.gtx.ReservationManagerHome</home>
<remote>com.bostoncoach.gtx.ReservationManager</remote>
<ejb-class>com.bostoncoach.gtx.ReservationManagerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<env-entry id="EnvEntry_1061575892797">
<env-entry-name>ejb10-properties/loglevel</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>bleach</env-entry-value>
</env-entry>
</session>
According to JavaDoc, getUserTransaction throws "java.lang.IllegalStateException - The Container throws the exception if the instance is not allowed to use the UserTransaction interface (i.e. the instance is of a bean with container-managed transactions)."
However, according to the definition of my bean in the deployment descriptor, this is a stateless session bean with bean-managed transactions, and hence should be fine. So what's up?
Many thanks for any help.
Jamie