activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wallace <>
Subject Get null topic connectionfatory from jboss jndi
Date Wed, 25 Apr 2007 17:00:36 GMT

I am following the instruction on
to integrate jboss4.0.5/activemq4.0.

I have a problem with looking up connection factory with remote jboss jndi
I have this in –ds.xml



I tried to look up the connection factory with code.
        try { 
           Properties env2 = new Properties();
           env2.put(Context.PROVIDER_URL, "jnp://localhost:1099");
           InitialContext jndiContext = new InitialContext(env2);       

            // print the binding info
            NamingEnumeration<NameClassPair> namingEnum =
             while (namingEnum.hasMore()) { 
              NameClassPair nameClassPair =; 
              System.out.println("Name: " + nameClassPair.getName() + " ,
Class: " + nameClassPair.getClassName() ); 
            ref = jndiContext.lookup("testing/TopicConnectionFactory"); 
            System.out.println("ref is null:" + (ref==null)); 
            TopicConnectionFactory tFactory = (TopicConnectionFactory)
                    .narrow(ref, TopicConnectionFactory.class); 
        } catch (NameNotFoundException e) { 

I got the following print out:

Name: JVTEventTopic , Class: org.apache.activemq.command.ActiveMQTopic 
Name: QueueConnectionFactory , Class:
Name: TopicConnectionFactory , Class:
Name: MessageQueue , Class: org.apache.activemq.command.ActiveMQQueue 
Name: XVTEventTopic , Class: org.apache.activemq.command.ActiveMQTopic

ref is null

Note that I did NOT get any NameNotFoundException and the print out actually
shows that the binding is correct. So why would I get null when I tried to
lookup "testing/TopicConnectionFactory"?
I have the activemq-ra-4.0.2.jar file in the <jboss>/server/default/lib

And I want to configure the topic connection factory with ra.xml, so I
cannot use activemq jndi.


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message