ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Spring MQ integration problem

Post new topic  Reply to topic
 Spring MQ integration problem « View previous topic :: View next topic » 
Author Message
spatonai
PostPosted: Tue Jun 07, 2011 1:11 am    Post subject: Spring MQ integration problem Reply with quote

Newbie

Joined: 07 Jun 2011
Posts: 1

Dear All,

I'm new to Spring, and facing to a probably basic problem.
I'm trying to configure

MQQueue Conection Factory as a spring bean in see below:


<bean id="jmsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">

<property name="transportType">
<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" />
</property>

<property name="queueManager">
<value>MQJMS.QManager</value>
</property>
<property name="hostName">
<value>localhost</value>
</property>
<property name="port">
<value>1414</value>
</property>
<property name="channel">
<value>1</value>
</property>
</bean>

and I got the following exception:

INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@779b04e2: defining beans [jmsConnectionFactory,destination,jmsTemplate,jmsReceiver]; root of factory hierarchy
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConnectionFactory' defined in class path resource [mq.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ibm.mq.jms.MQQueueConnectionFactory]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
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.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at wsmq.ReceiveMQSpringJMS.main(ReceiveMQSpringJMS.java:1
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.ibm.mq.jms.MQQueueConnectionFactory]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
... 13 more
Caused by: java.lang.NullPointerException
at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:169)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:176)
at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:286)
at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:76)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
... 15 more

What do I do wrong?
I found out that in the class JmsConnectionFactory the line which cause the NullPointer exception is :

providerFactory = ((JmsFactoryFactoryImpl)JmsFactoryFactoryImpl.getInstance(connectionTypeName)).getProviderFactoryFactory();

so probably the connectionTypeName is missing, or not good...

this property comes from

connectionTypeName = getStringProperty("XMSC_CONNECTION_TYPE_NAME");

but I do not know why this property is not set, and how to set it...

Thanks a lot in advance!

Szabi
Back to top
View user's profile Send private message
exerk
PostPosted: Tue Jun 07, 2011 7:58 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

I'm going out on a limb here because I know nothing of Spring, but I would expect to see something like the following:

Code:
<property name="queueManager">
<value>MY_QMGR_NAME</value>
</property>
<property name="hostName">
<value>localhost</value>
</property>
<property name="port">
<value>1414</value>
</property>
<property name="channel">
<value>MY.CLIENT.CHANNEL.NAME</value>
</property>
</bean>

Where MY_QMGR_NAME is the actual name of your queue manager and MY.CLIENT.CHANNEL.NAME is the name of the SVRCONN you have defined for the application to connect.

And yes, before someone points out that the example channel name I have used exceeds the string maximum of twenty characters, it is just an example.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 07, 2011 8:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

exerk wrote:
Where MY_QMGR_NAME is the actual name of your queue manager and MY.CLIENT.CHANNEL.NAME is the name of the SVRCONN you have defined for the application to connect.

And yes, before someone points out that the example channel name I have used exceeds the string maximum of twenty characters, it is just an example.


Nice catch. I'd noticed that there was a channel parameter, but not that it was set to the value of "1".

And I really hope the name of the actual SVRCONN in use is not "1".
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 07, 2011 8:47 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

As this post shows quite some lack of understanding of some MQ fundamentals, I believe we should attach to it a must read:

client manual in the infocenter

MQ client server tutorial

And as you're studying remember to look at the Using Java manual -- WebSphere MQ classes for JMS too.

As this is spring framework related moving to java forum.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Spring MQ integration problem
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.