J2CA0079E, java.lang.IllegalStateException, and J2CA0046E errors occur when invoking a Message Driven Bean (MDB)
 Technote (FAQ)
 
Problem
When invoking an MDB, the following error might appear in the SystemOut.log:

[2/21/06 10:38:36:292 EST] 00000095 MCWrapper E J2CA0079E: Method setManagedConnection has detected an internal illegal state and is throwing an IllegalStateException. The exception is: java.lang.IllegalStateException: setManagedConnection: illegal state exception. State = STATE_TRAN_WRAPPER_INUSE
at com.ibm.ejs.j2c.MCWrapper.setManagedConnection(MCWrapper.java:680)
...
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:583)
at com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle.createQueueConnection(JMSQueueConnectionFactoryHandle.java:84)
...
 
Cause
The ejbCreate method of the message driven bean invokes the 'createQueueConnection' method which creates a queue connection for later use.

Since an MDB is a stateless session bean, there is no guarantee that any variables set on the first invocation of the bean will be the same on the second invocation of the bean.

 
Solution
The application code should be reviewed. Queue connection factories and datasource connections should not be created during the ejbCreate method.

Instead, they should be created immediately before they are used and should be closed immediately after they are no longer required.
 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
Historical Number
15722
278
000
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > EJBDeploy (WSAD)
Operating system(s): Windows
Software version: 6.0
Software edition:
Reference #: 1236664
IBM Group: Software Group
Modified date: May 1, 2006