geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From axiez <lesai...@gmail.com>
Subject Re: NameNotFoundException for connection factory
Date Thu, 29 Jan 2009 06:45:07 GMT

It worked fine. Got some warnings but the end result is good.
Modified jndi.properties file is given below:
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=vm://localhost
connectionFactoryNames=w
queue.qi=q
topic.acierage=ac
java.naming.security.principal=system
java.naming.security.credentials=manager
When executed I got the following warning messages:
log4j: WARN No appenders could be found for logger
(org.apache.activemq.broker.jmx.ManagementContext)
log4j:WARN Please initialize the log4j system properly.

axiez wrote:
> 
> I created a JMS Resource Group al with Connection Factory w, Topic ac and
> Queue qi. I tried to access the Connection Factory from a plain java class
> in the same JVM. While executing it from command prompt I am seeing the
> following error:
> javax.naming.NameNotFoundException: w
> All I have is MessageReceiving.java, MessageSending.java, MessageListener
> implementing class and jndi.properties. No descriptor files, no archive
> files. Code is:
> import javax.jms.*;
> import javax.jms.Queue;
> import java.util.*;
> import java.io.*;
> import javax.naming.*;
> class MessageReceiving {
>     public static void main(String[] args) throws Exception {
>         Properties p = new Properties();
>         p.load(new FileInputStream("jndi.properties"));
>         InitialContext ic = new InitialContext(p);
>         QueueConnectionFactory qcf = (QueueConnectionFactory)
> ic.lookup("w");
>         QueueConnection qc = qcf.createQueueConnection();
>         QueueSession qs =
> qc.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
>         Queue q = (Queue) ic.lookup("q");
>         QueueReceiver qreceiver = qs.createReceiver(q);
>         qreceiver.setMessageListener(new MyListener());
>         qc.start();
>         Thread.currentThread().join();
>     }
> }
> jndi.properties
> ----------------
> java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
> java.naming.provider.url=vm://localhost
> java.naming.security.principal=system
> java.naming.security.credentials=manager
> I have seen the help to my previous questions but unable to figure out
> where it's going wrong.
> 

-- 
View this message in context: http://www.nabble.com/NameNotFoundException-for-connection-factory-tp21703497s134p21721725.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message