Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WAS50 JMS IllegalStateException calling setMessageListener

Status
Not open for further replies.

vhalbert

Programmer
Jun 13, 2003
2
US
In WAS 5.0, I'm using the embedded JMS Provider. I have a client app trying to talk to the bean. I can get the initial context, topic factory and topics, but I get the following error when the client tries to talk to the bean:

javax.jms.IllegalStateException: Method setMessageListener not permitted
at com.ibm.ejs.jms.JMSCMUtils.methodNotPermittedException(JMSCMUtils.java:200)
at com.ibm.ejs.jms.JMSMessageConsumerHandle.setMessageListener(JMSMessageConsumerHandle.java:199)
at com.metamatrix.common.messaging.JMSMessageBus.addListener(JMSMessageBus.java:108)
at com.metamatrix.common.messaging.VMMessageBus.addListener(VMMessageBus.java:79)
at com.metamatrix.platform.registry.MetaMatrixRegistryImpl.init(MetaMatrixRegistryImpl.java:100)
at com.metamatrix.platform.registry.MetaMatrixRegistryImpl.<init>(MetaMatrixRegistryImpl.java:76)
at com.metamatrix.platform.registry.MetaMatrixRegistryControllerImpl.<init>(MetaMatrixRegistryControllerImpl.java:39)
at com.metamatrix.platform.registry.MetaMatrixVMRegistry.initialize(MetaMatrixVMRegistry.java:58)
at com.metamatrix.platform.registry.MetaMatrixVMRegistry.getController(MetaMatrixVMRegistry.java:77)
at com.metamatrix.platform.registry.MetaMatrixVMRegistry.registerVMController(MetaMatrixVMRegistry.java:251)
at com.metamatrix.platform.vm.controller.AppServerVMController.init(AppServerVMController.java:101)
at com.metamatrix.platform.security.api.beans.LogonAPIBean.ejbCreate(LogonAPIBean.java:67)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:126)
at com.ibm.ejs.container.CMStatelessBeanO.<init>(CMStatelessBeanO.java:53)
at com.ibm.ejs.container.CMStatelessBeanOFactory.create(CMStatelessBeanOFactory.java:40)
at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:566)
at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:653)
at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:78)
at com.ibm.ejs.container.activator.Activator.activateBean(Activator.java:518)
at com.ibm.ejs.container.EJSContainer.preInvoke_internal(EJSContainer.java:2522)
at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:2259)
at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:2245)
at com.metamatrix.platform.security.api.EJSRemoteStatelessLogonAPIHome_4996d5f4.getEncryptor(Unknown Source)
at com.metamatrix.platform.security.api._LogonAPI_Stub.getEncryptor(_LogonAPI_Stub.java:658)
at com.metamatrix.platform.util.MetaMatrixController.checkAppServer(MetaMatrixController.java:176)


It appears that some type permission must be set, but I've tried the topic factory J2C authentication, global security and tried adding permissions in the integral-jms-authorizations.xml file; but it seems I haven't hit the right combination. Can anyone suggest a solution or to try something else?
 
I found my answer in another forum (and the short is that I must use MQ Series):

It is within the J2EE
1.3 specification for an application server to allow setMessageListener to
be called from within the web container. The reason WebSphere does not
permit its use, despite the fact that the WebSphere web container does allow
threads to be spun off, is because the asynchronous nature of this call
interferes with the management (sharing, pooling etc.) of the JMS connection
by both the EJB and web containers.

Because of the wording of the specification, use of this method is not
portable and, indeed, the restriction has been tightened up in the draft
J2EE 1.4 specification:

&quot;The following methods may only be used by application components executing
in the application client container:

- javax.jms.Session method setMessageListener
- javax.jms.Session method getMessageListener
- javax.jms.Session method run
- javax.jms.QueueConnection method createConnectionConsumer
- javax.jms.TopicConnection method createConnectionConsumer
- javax.jms.TopicConnection method createDurableConnectionConsumer
- javax.jms.MessageConsumer method getMessageListener
- javax.jms.MessageConsumer method setMessageListener
- javax.jms.Connection method setExceptionListener
- javax.jms.Connection method stop
- javax.jms.Connection method setClientID

A J2EE container may throw a JMSException (if allowed by the method) if the
application component violates these restrictions.&quot;

 
So what is the proper way to use JMS in an EJB? I have the
same problem, although I did not call the setMessageListener
directly in the EJB code, I tried to call another (singleton)
object that does the setMessageListener, and has the
same problem.

thanks for any suggestions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top