|
Problem(Abstract) |
The following exception occurs during a heavy load on a
message-driven bean (MDB):
CNTR0020E: Non-application exception occurred while processing
method "method_name" on bean "BeanId(bean_name, null)".
Exception data:
java.lang.NullPointerException |
|
|
|
Cause |
This error can be due to a fundamental programming error
in an application. The error occurs when a connection object is used by a
thread other than the one that created the object.. Because the connection
object is a J2C object, it is transactional and must not be cached. At any
given time, this resource might be given back to the resource pool to
maintain resources. If the thread releases the resource, it becomes null.
A separate thread that uses the cached information of the resource then
receives a null pointer exception if it tries to access the resource. The
connection object can be used by only the thread that creates it. |
|
|
Resolving the
problem |
The application code must be changed to adhere to standard
programming practice.
The ejbCreate() method of the MDB contains code to look up and create an
instance of a Stateless Session bean. The ejbCreate() method of the
Stateless Session bean contains the following code:
queueConnection = queueConnFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
queueConnection.start();
queueSender = queueSession.createSender(queue);
myMsg = queueSession.createMessage();
This code must be moved from the ejbCreate() method of the Stateless
Session bean to the point where it is immediately required. In general,
this code appears in a method that performs some type of business logic
outside of the ejbCreate() method. |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|