简体   繁体   中英

Using Websphere AS JMS resources from embedded Mule

I'm trying to use managed JMS resources of WAS in embedded Mule ESB, with jms connector as below:

<jms:connector name="JMS" 
validateConnections="true" 
jndiInitialFactory="com.ibm.websphere.naming.WsnInitialContextFactory" 
connectionFactoryJndiName="jms/mycf" 
doc:name="JMS" 
specification="1.1" 
embeddedMode="true"/>

Connection factory is found by Mule with no problem, but when trying to get connection Mule ends up with the following:

Caused by: javax.jms.IllegalStateException: Method setExceptionListener not permitted
at com.ibm.ejs.jms.JMSCMUtils.methodNotPermittedException(JMSCMUtils.java:244)
at com.ibm.ejs.jms.JMSConnectionHandle.checkRestrictedMethod(JMSConnectionHandle.java:854)
at com.ibm.ejs.jms.JMSConnectionHandle.setExceptionListener(JMSConnectionHandle.java:353)
at org.springframework.jms.connection.SingleConnectionFactory.prepareConnection(SingleConnectionFactory.java:395)
at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:306)
at org.springframework.jms.connection.SingleConnectionFactory.getConnection(SingleConnectionFactory.java:283)
at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:224)
at org.mule.transport.jms.Jms11Support.createConnection(Jms11Support.java:72)
at org.mule.transport.jms.JmsConnector.createConnection(JmsConnector.java:450)
at org.mule.transport.jms.JmsConnector.doConnect(JmsConnector.java:547)
at org.mule.transport.AbstractConnector.connectConnectorAndReceivers(AbstractConnector.java:1663)
at org.mule.transport.AbstractConnector$5.doWork(AbstractConnector.java:1629)
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:63)

Any guess about how this could be resolved?

Does Mule really need to set this ExceptionListener or it could be skipped somehow?

Finally I found a way to get rid of this exception, by simply adding this into connector definition:

cacheJmsSessions="false"

This could not be set from the interface because of default true and checkbox control provided, but still could be added manually into XML.

This option being set to false skips creation of connection factory decorator (CustomCachingConnectionFactory), so the connection is OK after that.

But anyway, Mule then fails with message consumer as follows:

Caused by: org.mule.api.lifecycle.LifecycleException: Method getMessageListener not permitted
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$SubReceiver.doStart(MultiConsumerJmsMessageReceiver.java:325)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver.startSubReceivers(MultiConsumerJmsMessageReceiver.java:235)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver.doStart(MultiConsumerJmsMessageReceiver.java:114)
at org.mule.transport.AbstractMessageReceiver.doStartHandler(AbstractMessageReceiver.java:473)
at org.mule.transport.AbstractTransportMessageHandler$3.onTransition(AbstractTransportMessageHandler.java:321)
at org.mule.lifecycle.AbstractLifecycleManager.invokePhase(AbstractLifecycleManager.java:138)
at org.mule.transport.ConnectableLifecycleManager.fireStartPhase(ConnectableLifecycleManager.java:48)
at org.mule.transport.AbstractTransportMessageHandler.start(AbstractTransportMessageHandler.java:317)
at org.mule.transport.AbstractConnector.registerListener(AbstractConnector.java:1303)
at org.mule.endpoint.DefaultInboundEndpoint.start(DefaultInboundEndpoint.java:105)
... 77 more
Caused by: javax.jms.IllegalStateException: Method getMessageListener not permitted
at com.ibm.ejs.jms.JMSCMUtils.methodNotPermittedException(JMSCMUtils.java:244)
at com.ibm.ejs.jms.JMSMessageConsumerHandle.getMessageListener(JMSMessageConsumerHandle.java:369)
at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$SubReceiver.doStart(MultiConsumerJmsMessageReceiver.java:316)

It happens because Mule embedded disrespects j2ee specification, which states that methods such as getMessageListener/setMessageListener could not be called from EE/Web containers.

So it looks rather impossible to use standard JMS connector with Websphere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM