I am trying to connect to a MQ connection factory defined in Websphere app Server 7.0.
But I couldnt find a right connectionfactory interface for the MQ to define in Spring.
However when I tried to hardcode the connection details in the spring config file, I am able to connect to the Queue Manager.
What is the right interface/format to use in Spring beans to load the MQ connection factory defined in Websphere appl server?
Working Code
<bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostName">
<value>127.0.0.1</value>
</property>
<property name="port">
<value>1414</value>
</property>
<property name="queueManager">
<value>MYQM</value>
</property>
<property name="transportType">
<value>1</value>
</property>
</bean>
Not Working Code
<bean id="mqConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jms/WASQM"/>
<property name="lookupOnStartup" value="false"/>
<property name="cache" value="true" />
<property name="proxyInterface" value="com.ibm.mq.jms.MQQueueConnectionFactoryFactory" />
</bean>
where WASQM is the MQ connection factory defined in Websphere
Error with the Non working code
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mqConnectionFactory' defined in ServletContext resource [/WEB-INF/config/config-mq.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: [com.ibm.mq.jms.MQQueueConnectionFactoryFactory] is not an interface
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)
Caused by: java.lang.IllegalArgumentException: [com.ibm.mq.jms.MQQueueConnectionFactoryFactory] is not an interface
I need help in replacing the not working code with a right code. Spring - 3.0.5 IBM MQ and Web App Servers - 7.0
Right way to do is
Use javax.jms.QueueConnectionFactory as the connection factory in spring config
<bean id="mqConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="WASQM"/>
<property name="lookupOnStartup" value="false"/>
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.jms.QueueConnectionFactory" />
</bean>
This page gave me the hint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With