"javax.jms.IllegalStateException: Method setMessageListener not permitted" in a Java Enterprise Edition (J2EE) application

Technote (troubleshooting)


Problem(Abstract)

Application receives message
javax.jms.IllegalStateException: Method setMessageListener not permitted when running inside IBM® WebSphere® Application Server EJB or Web container.

Cause

While it was permitted in a Java Standard Edition (Java SE) application and WebSphere Application Server V4.0 to use the method setMessageListener for asynchronous messaging, it is forbidden to use this method in a WebSphere Application Server EJB or Web container application that supports J2EE 1.3 or later versions due a restriction by the following J2EE™ specification. The J2EE specification lists a number of interfaces that may not be used by "portable J2EE applications". It also lists a number of methods that may be used in "the application client container" but not in the EJB or Web container. This is listed in the section 6.6 "Java™ Message Service (JMS) 1.1 Requirements" of the J2EE 1.4 specification:http://java.sun.com/j2ee/j2ee-1_4-fr-spec.pdf

One of the methods listed in the list of methods forbidden from the EJB and Web containers is the method
- javax.jms.Session method setMessageListener

For the complete list of methods, see the J2EE specification.


Resolving the problem

Refer to the WebSphere Application Server Information Center article "Programming to use asynchronous messaging", which includes the J2EE based programming models, such as Message Driven Beans and also includes links for developing JMS Client applications which can call setMessageListener since they run outside of a WebSphere EJB or Web container.

Cross reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

WebSphere Application Server
Java Message Service (JMS)

Software version:

6.0, 6.1, 7.0, 8.0

Operating system(s):

AIX, HP-UX, IBM i, Linux, Solaris, Windows, i5/OS, z/OS

Software edition:

Edition Independent

Reference #:

1114239

Modified date:

2007-09-17

Translate my page

Machine Translation

Content navigation