You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Anshuk <An...@cognizant.com> on 2009/05/15 06:36:04 UTC

geronimo 1.1.1 jms resource

Hi, 

I am using geronimo 1.1.1 and there is a specfic requirement for some jms
resources. I have created a queue connection factory and a queue from the
web console.
I am writing a standalone jms client to send message to the queue, but I
presume it is failing to lookup.
I did a similar kind of practice earlier, but I forgot what was the
solution.

Properties props = new Properties();
props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616");
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.activemq.jndi.ActiveMQInitialContextFactory");
Context ctxt = new InitialContext(props);
QueueConnectionFactory factory = (QueueConnectionFactory)
ctxt.lookup("TestConnectionFactory");
			
It is failing while doing the TestConnectionFactory lookup.

Can anyone help me in this.


Reagrds,
Anshuk Pal Chaudhuri
-- 
View this message in context: http://www.nabble.com/geronimo-1.1.1-jms-resource-tp23553289s134p23553289.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: geronimo 1.1.1 jms resource

Posted by David Jencks <da...@yahoo.com>.
see http://activemq.apache.org/jndi-support.html

I think you are missing the specification of the connection factory  
you want to look up in your properties object.

thanks
david jencks

On May 14, 2009, at 9:36 PM, Anshuk wrote:

>
> Hi,
>
> I am using geronimo 1.1.1 and there is a specfic requirement for  
> some jms
> resources. I hav

those will be available in the server but not remotely.

> e created a queue connection factory and a queue from the
> web console.
> I am writing a standalone jms client to send message to the queue,  
> but I
> presume it is failing to lookup.
> I did a similar kind of practice earlier, but I forgot what was the
> solution.
>
> Properties props = new Properties();
> props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616");
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.activemq.jndi.ActiveMQInitialContextFactory");
> Context ctxt = new InitialContext(props);
> QueueConnectionFactory factory = (QueueConnectionFactory)
> ctxt.lookup("TestConnectionFactory");
> 			
> It is failing while doing the TestConnectionFactory lookup.
>
> Can anyone help me in this.
>
>
> Reagrds,
> Anshuk Pal Chaudhuri
> -- 
> View this message in context: http://www.nabble.com/geronimo-1.1.1-jms-resource-tp23553289s134p23553289.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Re: geronimo 1.1.1 jms resource

Posted by Anshuk <An...@cognizant.com>.
Thanks David.
It is now working. I added the jndi.properties in the classpath and also
tweaked the code a bit.

 jndi.properties 

java.naming.factory.initial =
org.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url = tcp://localhost:61616
connectionFactoryNames = TestQueueConnectionFactory 
queue.sampleQueue = sampleQueue

code:

Properties props = new Properties();
			fis = new java.io.FileInputStream((new
java.io.File("config/jndi.properties")));
		    props.load(fis);
		    Context ctxt = new InitialContext(props);
			QueueConnectionFactory factory = (QueueConnectionFactory)
ctxt.lookup("TestQueueConnectionFactory");
			
			
			
			Queue queue = (Queue)ctxt.lookup(props.getProperty("queue.sampleQueue"));


It clearly mentions in the link..

Once you have the jndi.properties edited and ready, it needs to be
accessible to your application. The easiest way is to add jndi.properties to
a jar file. When "new InitialContext()" is called, it will scan the
resources and find the file. If you get "javax.naming.NamingException", it
usually means the jndi.properties file is not accessible.


Thanks.

Reagards,
Anshuk Pal Chaudhuri


Anshuk wrote:
> 
> Hi, 
> 
> I am using geronimo 1.1.1 and there is a specfic requirement for some jms
> resources. I have created a queue connection factory and a queue from the
> web console.
> I am writing a standalone jms client to send message to the queue, but I
> presume it is failing to lookup.
> I did a similar kind of practice earlier, but I forgot what was the
> solution.
> 
> Properties props = new Properties();
> props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616");
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.activemq.jndi.ActiveMQInitialContextFactory");
> Context ctxt = new InitialContext(props);
> QueueConnectionFactory factory = (QueueConnectionFactory)
> ctxt.lookup("TestConnectionFactory");
> 			
> It is failing while doing the TestConnectionFactory lookup.
> 
> Can anyone help me in this.
> 
> 
> Reagrds,
> Anshuk Pal Chaudhuri
> 

-- 
View this message in context: http://www.nabble.com/geronimo-1.1.1-jms-resource-tp23553289s134p23554033.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.