geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: NameNotFoundException for connection factory
Date Wed, 28 Jan 2009 17:31:07 GMT

On Jan 28, 2009, at 2:47 AM, 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.


Geronimo has a (global) naming system that you can configure by  
deploying connectors.  As the connectors start you can look in  
geronimo.log and see the jndi names stuff is bound under.
You can access this anywhere in the vm through new InitialContext();

Each javaee app module has a private java:comp jndi context that you  
configure in the javaee app.
You can access this anywhere in a javaee module through new  
InitialContext();

Activemq has a jndi naming system that you configure with a properties  
file, such as your jndi.properties -- although you need more info to  
actually get anything to look up, see the amq docs.
You can access this anywhere with new InitialContext(properties);

Each of these are separate naming systems and don't overlap.  You  
appear to be trying to access the geronimo global naming system   
through the activemq jndi system, which are disjoint, so it won't work.

hope this helps
david jencks


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


Mime
View raw message