I am migrating my application from jboss4 to wildfly 8. We are listening to few JMS topics available over wmq at different hosts. In jboss-4 we had jboss-service.xml which contained few mbean related to that, my main concern is how can I configure same mbeans or jmx queues in wildfly's standalone.xml.

I have added connection factory as shown in link I attached but there are few concerns as below.

1) In given link connection factory class is "com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" (class available in jmx.jar) where as in my older configuration it was jmx.service.wsmq.WSMQConnectionFactory. (available in 8.X-wmq.jmsra.rar --- Is it because I also updated my wmq-adapter from version 4.X to 8.X)

2) After adding below xml configuration wildfly is not able to map objects corresponding to jndi names. Below is snippet from my standalone.xml file.

** I have added module com.ibm.wmq.jmsra in wildfly's modules/system/layers/base directory and I am not getting any error regarding that but my JNDI View from Admin Console is showing '?' for objects against newly added JNDI names like below.

So bottom line is, now I am getting Spring's DI related exception as we are referring this connection factory into spring's JmsTemplate's bean.

Exception :

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsTemplate' defined in class path resource [com/project/jms/jmsContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Specified a Spring JMS 1.0.2 template for queues but did not supply an instance of QueueConnectionFactory

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)

... 34 more

Caused by: java.lang.IllegalArgumentException: Specified a Spring JMS 1.0.2 template for queues but did not supply an instance of QueueConnectionFactory

at org.springframework.jms.core.JmsTemplate102.afterPropertiesSet(JmsTemplate102.java:140)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

1) In given link connection factory class is "com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" (class available in jmx.jar) where as in my older configuration it was jmx.service.wsmq.WSMQConnectionFactory. (available in 8.X-wmq.jmsra.rar --- Is it because I also updated my wmq-adapter from version 4.X to 8.X)

I'm not sure why it changed, but my guess is that you don't need jmx.service.wsmq.WSMQConnectionFactory anymore because you don't need to configure it as a JMX MBean now like you did in JBoss AS 4.x.

2) After adding below xml configuration wildfly is not able to map objects corresponding to jndi names. Below is snippet from my standalone.xml file.

It may be because you haven't passed the configuration details necessary to actually set up the connection factory and/or destination (e.g. hostname, port, channel name, etc.). But that's just a guess.

Caused by: java.lang.IllegalArgumentException: Specified a Spring JMS 1.0.2 template for queues but did not supply an instance of QueueConnectionFactory

This is probably because you're forcing the Spring client to use the 1.0.2 interfaces but com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl is giving you a javax.jms.ConnectionFactory (which 1.0.2 doesn't support). You could try using org.springframework.jms.core.JmsTemplate instead or configuring "java:/MQQueueConnectionFactory" specifically to be a queue connection factory.

Caused by: java.lang.IllegalArgumentException: Specified a Spring JMS 1.0.2 template for queues but did not supply an instance of QueueConnectionFactory

This is probably because you're forcing the Spring client to use the 1.0.2 interfaces but com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl is giving you a javax.jms.ConnectionFactory (which 1.0.2 doesn't support). You could try using org.springframework.jms.core.JmsTemplate instead or configuring "java:/MQQueueConnectionFactory" specifically to be a queue connection factory.

As you said "com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl is giving a javax.jms.ConnectionFactory only" the instance of check in code of JmsTemplate102's code fails and throws an exception.

/**
* In addition to checking if the connection factory is set, make sure
* that the supplied connection factory is of the appropriate type for
* the specified destination type: QueueConnectionFactory for queues,
* and TopicConnectionFactory for topics.
*/
public void afterPropertiesSet() {
super.afterPropertiesSet();
// Make sure that the ConnectionFactory passed is consistent.
// Some provider implementations of the ConnectionFactory interface
// implement both domain interfaces under the cover, so just check if
// the selected domain is consistent with the type of connection factory.
if (isPubSubDomain()) {
if (!(getConnectionFactory() instanceof TopicConnectionFactory)) {
throw new IllegalArgumentException(
"Specified a Spring JMS 1.0.2 template for topics " +
"but did not supply an instance of TopicConnectionFactory");
}
}
else {
if (!(getConnectionFactory() instanceof QueueConnectionFactory)) {
throw new IllegalArgumentException(
"Specified a Spring JMS 1.0.2 template for queues " +
"but did not supply an instance of QueueConnectionFactory");
}
}
}

So this issue was resolved after replacing JmsTemplate102 with parent class JmsTemplate.

2) After adding below xml configuration wildfly is not able to map objects corresponding to jndi names. Below is snippet from my standalone.xml file.

It may be because you haven't passed the configuration details necessary to actually set up the connection factory and/or destination (e.g. hostname, port, channel name, etc.). But that's just a guess.

I had added hostname, port and channel name etc. properties under system properties tag in standalone.xml, also tried by directly providing as text in my jmscontext.xml still did not work.

For now my work is not hampered but still I can not see any objects against the jndi names as shown in previous image. Can you please also help me resolving that as well.

I had added hostname, port and channel name etc. properties under system properties tag in standalone.xml...

I'm not clear on how system properties would work in this use-case. Are certain system property values automatically used by the WSMQ JCA RA? Why not simply use <config-property> elements as demonstrated in the linked documentation?

...also tried by directly providing as text in my jmscontext.xml still did not work.

Is it possible to configure the WSMQ JCA RA from the jmscontext.xml? Please elaborate.

Ohh ok you mean that configuration, I also felt that when you mentioned about channel name. Yes that configuration (host, port and channel) goes within <resource-adapter>'s tag only. Actually I was thinking about jmscontext.xml's (java.naming.provider.url) properties value.

So, I assume once I set configuration, connectionFactory object will be provided by Queue Manager and right now my Queue Manager is not yet set up at WMQ so I need to wait till then.

I assume your Spring application is running in the same JVM as the Wildfly server. If that's the case then you shouldn't need to set any properties on your InitialContext. A blank InitialContext will automatically connect to the in-VM JNDI server.

As noted previously, my guess is that since the WSMQ JCA RA can't actually connect to a valid WSMQ instance then it can't properly create the connection factory. If you set up your WSMQ instance and properly configure the JCA RA to connect to it and it still doesn't work then come back on this thread and explain the situation.

This was the only problem after solving that I was able to communicate with MQ, actually in this thread you solved 2-3 problems but I think this one was very important and hard for anyone to identify so marking this as correct answer. Thanks a lot for you help and immediate response for every time. Though I am still getting those question marks in Admin-Conse->JNDIview for MQConnectionFactory and QueueName instead of the Objects (shown as below) but I can see my ip in MQs logs, so I don't care about this issue anymore.

I am very happy that now it is working as expected, Thank you so much again.