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 » How to define MQ QueueConnectionFactory in spring using JNDI

Post new topic  Reply to topic
 How to define MQ QueueConnectionFactory in spring using JNDI « View previous topic :: View next topic » 
Author Message
saranj
PostPosted: Mon Nov 26, 2007 1:20 pm    Post subject: How to define MQ QueueConnectionFactory in spring using JNDI Reply with quote

Newbie

Joined: 07 Nov 2007
Posts: 7

Hi all,

I have created MQ Connection factory and MQ Queue on WAS thru admin console.

I am trying to define these information on Spring configuration file. here is my spring file.

[code]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="msgSender"
class="com.hermes.dataaccess.esr.jms.MessageSender " >
<property name="jmsTemplate">
<ref bean="jmsQueueTemplate"/>
</property>
</bean>

<bean id="msgReceiver"
class="com.hermes.dataaccess.esr.jms.MessageReceiv er">

</bean>

<!-- mq Queue Connection Factory -->
<bean id="internalJmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>jms/HermesCF</value>
</property>
</bean>


<bean id="destinationQueue" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>jms/DeliveryQueue</value>
</property>
</bean>


<!-- JMS Template -->
<bean id="jmsQueueTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory">
<ref local="internalJmsQueueConnectionFactory" />
</property>
<property name="defaultDestination">
<ref bean="destinationQueue"/>
</property>
</bean>


<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="concurrentConsumers" value="1"/>
<property name="connectionFactory" ref="internalJmsQueueConnectionFactory"/>
<property name="destination" ref="destinationQueue" />
<property name="messageListener" ref="msgReceiver"/>
<property name="sessionTransacted" value="true"/>
</bean>

</beans> [/code]

While running the server, am getting the following error.

[code]
11/26/07 16:07:08:359 EST] 00000047 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'msgSender' defined in ServletContext resource [/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Cannot resolve reference to bean 'jmsQueueTemplate' while setting bean property 'jmsTemplate'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jmsQueueTemplate' defined in ServletContext resource [/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Cannot resolve reference to bean 'internalJmsQueueConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'internalJmsQueueConnectionFactory' defined in ServletContext resource [/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Context: PSILAP01Node01Cell/nodes/PSILAP01Node01/servers/server1, name: jms/HermesCF: First component in name HermesCF not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0]
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'jmsQueueTemplate' defined in ServletContext resource [/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Cannot resolve reference to bean 'internalJmsQueueConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'internalJmsQueueConnectionFactory' defined in ServletContext resource [/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Context: PSILAP01Node01Cell/nodes/PSILAP01Node01/servers/server1, name: jms/HermesCF: First component in name HermesCF not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0]
Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'internalJmsQueueConnectionFactory' defined in ServletContext resource [/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Context: PSILAP01Node01Cell/nodes/PSILAP01Node01/servers/server1, name: jms/HermesCF: First component in name HermesCF not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0]
Caused by: javax.naming.NameNotFoundException: Context: PSILAP01Node01Cell/nodes/PSILAP01Node01/servers/server1, name: jms/HermesCF: First component in name HermesCF not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_ resolve_complete_info(WsnOptimizedNamingImpl.java: 543)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBa se.resolve_complete_info(WsnOptimizedNamingImplBas e.java:2213)
at com.ibm.WsnOptimizedNaming._NamingContextStub.reso lve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve (CNContextImpl.java:4043)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(C NContextImpl.java:1746)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(C NContextImpl.java:1707)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt( CNContextImpl.java:1412)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNC ontextImpl.java:1290)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCt x.java:145)
at javax.naming.InitialContext.lookup(InitialContext. java:361)
at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
[/code]


Am i missing anything on Spring configuration file ? Pls help me.

Thanks
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 26, 2007 6:51 pm    Post subject: Reply with quote

Grand High Poobah

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

Quote:
[/WEB-INF/classes/hermesweb/com/hermes/spring/spring.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException:

Has the proper JNDI context been created on WAS BEFORE starting the application and has the WAS instance been restarted to take advantage of that context??
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
saranj
PostPosted: Tue Nov 27, 2007 11:30 am    Post subject: Reply with quote

Newbie

Joined: 07 Nov 2007
Posts: 7

Hi Saper,

Thanks for your reply. I've found out the issue...I've created queue connection factory and queue at the NODE level on WAS but context was pointing to Server level ALWAYS.

Once i created connection and queue under server level , everything worksfine. but i wanted to have connection factory and queue at the CELL level.

how can i do that ? anyone have any information.

[quote]

Caused by: javax.naming.NameNotFoundException: Context: [b]PSILAP01Node01Cell/nodes/PSILAP01Node01/servers/server1[/b], name: jms/HermesCF: First component in name HermesCF not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDLmg.org/CosNaming/NamingContext/NotFound:1.0

[/quote]
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Nov 27, 2007 11:33 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Name resolution should propagate up through server, node, and cell.

Was nodeagent and dmgr running at the time? They have to be, to respond to JNDI requests for node & cell context.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
JLRowe
PostPosted: Thu Nov 29, 2007 2:16 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

Perhaps you created the resource at the deployment manager node level? not the node hosting your server.

JNDI definitions propagate downwards, so a node level definition is available to all servers on the cell.

The JNDI tree is replicated, so it doesn't matter if the node agent or dmgr are down.
Back to top
View user's profile Send private message Send e-mail
matpil
PostPosted: Mon Feb 04, 2008 4:32 am    Post subject: configure spring Reply with quote

Newbie

Joined: 04 Feb 2008
Posts: 2

it's possible to configure spring to call a backout function?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to define MQ QueueConnectionFactory in spring using JNDI
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.