2

I am trying to make current Spring application work with Websphere 7 default JMS provider. I have created a Bus and assign a queue with it, also a SIB QueueConnectionFactory, a SIB Queue and a Activation Specification and link it with the SIB queue. I am assured that the message engine started for the application server.

So there is my web.xml to refer the JNDI resource

<!-- Question: should I define Activation Specification here as well as a resource ? -->
<resource-ref>
    <description>JNDI JMS Conn Factory </description>
    <res-ref-name>jms/ConnectionFactory</res-ref-name>
    <res-type>javax.jms.ConnectionFactory</res-type>
    <res-auth>Container</res-auth>
</resource-ref>
    <resource-ref>
    <description>JNDI JMS Queue </description>
    <res-ref-name>jms/queue/QueueOrderUpdate</res-ref-name>
    <res-type>javax.jms.Queue</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

The when I start the application, it gives me:

Could not refresh JMS Connection for destination 'ORDER.QUEUE' - retrying in 5000 ms. Cause: 
CWSIA0025E: The method setExceptionListener is not permitted in this container.
javax.jms.IllegalStateException: CWSIA0025E: The method setExceptionListener is not permitted 
in this container.

ORDER.QUEUE is what the app refers to the queue from WS:

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsCachingConnectionFactory" />
    <!-- same queue as jms/queue/QueueOrderUpdate -->
    <property name="defaultDestinationName" value="ORDER.QUEUE" />
    <property name="messageConverter" ref="orderMessageConverter"/>
</bean>

and that should be

<!-- I think this should be the queue defined for the bus but not the SIB queue right? -->
<jee:jndi-lookup id="jmsQueue" jndi-name="jms/queue/QueueOrderUpdate">
    <jee:environment>
        java.naming.provider.url=${java.naming.provider.url}
        java.naming.factory.initial=${java.naming.factory.initial}
        java.naming.factory.url.pkgs=${java.naming.factory.url.pkgs}
    </jee:environment>
</jee:jndi-lookup> 

It should be the queue I defined in Websphere: enter image description here

Here are my questions:

  1. If the default JMS provider is chosen from Websphere, then by default it should be the JCA compliant JMS implementation and I assume it should use the Activation Specification adapter instead of listener ports?
  2. If so, then should I link the Activation Specification JNDI in web.xml and Spring bean config instead of the Connection Factory? so there should be three in web.xml, one for ConnectionFactory, one for Queue and one for Activation Specification?
  3. Why the exception thrown?

UPDATE:

I find no listener ports bind to current server, please see following screenshot: enter image description here

Dreamer
  • 7,333
  • 24
  • 99
  • 179
  • Are you trying to send, receive or both in your application? – Gas Dec 03 '14 at 21:08
  • @Gas That's right. there is sender and receiver module in the same application. I am confused about whether need to register an Activation Specification or not for this application. [this](https://www.packtpub.com/books/content/messaging-websphere-application-server-70-part-1) example didn't mention it but I try that example and then get: CWSIA0005E: The JCA runtime failed to allocate a connection, seems cannot find message engine from the beginning.... – Dreamer Dec 03 '14 at 21:29
  • Cant you use normal EJB MDBs for receiving? You also mentioned listener ports, did you configured any in WAS? They shouldn't be used for default provider. – Gas Dec 03 '14 at 21:54
  • @Gas It's a Spring application, but the receiving part is pojo MDB. I am very confused about the port error as there is no port is defined in the bus or queue or connection factory. I really dont know where WS pick up that port, looks like it identified there "should be" a port by current settings.. – Dreamer Dec 03 '14 at 22:04
  • @Gas, I find something in the server settings, updated in the thread, not sure if that is related – Dreamer Dec 03 '14 at 22:11
  • For asyc receive you should use activation specification (not connection factory and queue. Queue is already defined in the AS). I'm not Spring expert in this area, but check this [sample for MQ](http://stackoverflow.com/a/22001414/3701228) maybe it will give you some hints... – Gas Dec 03 '14 at 22:22
  • @Gas Thanks. Two questions: 1)Regarding JNDI, if there is queue defined in AS, so the application should refer to the AS instead of queue? 2)As I remember it is either AS or listener port, so AS is taking care of inbound messaging? – Dreamer Dec 03 '14 at 22:38
  • If you send - use queue and qcf, for receive via message listener - use AS. Listener ports were used only for old MQ, which was not JCA. – Gas Dec 03 '14 at 22:58

1 Answers1

1

Looking to my old project with Spring JMS for WAS 7 I have nothing regarding JNDI in the web.xml.

My spring config on the matter looks like:

<bean id="connectionFactory" class="org.springframework.jms.connection.DelegatingConnectionFactory">
    <property name="targetConnectionFactory">
        <jee:jndi-lookup jndi-name="jms/StpConnectionFactory"/>
    </property>
    <property name="shouldStopConnections" value="true"/>
</bean>

<jee:jndi-lookup id="orderQueue" jndi-name="jms/queue/QueueOrderUpdate"/>

On WAS I remeber that I just used Default JMS Provider for the ConnectionFactory, as well for Destinations.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Thanks for the reply, it's my honor :). So in your old project is there anything related to Activation Specification in Websphere 7? Also sounds like `` does not require anything in web.xml? – Dreamer Dec 03 '14 at 18:49
  • M-m-m. Seems for me `Activation Specification` is needed for the MDB. Isn't it? Yes, that's true. Actually I have never used `` in the `web.xml` at all: JBOSS, WAS, WebLogic. All environment worked well for me. – Artem Bilan Dec 03 '14 at 20:49
  • thanks, that's handy. Could you please recall since which version of Spring can we avoid to define for JMS jndi? Is Spring 3.2 qualified? – Dreamer Dec 03 '14 at 21:10