Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 347753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:18:04+00:00 2026-05-12T11:18:04+00:00

I am trying to look up a QueueConnectionFactory and Queue via Geronimo’s JNDI. The

  • 0

I am trying to look up a QueueConnectionFactory and Queue via Geronimo’s JNDI. The Queue gets returned fine, but the QueueConnectionFactory lookup always returns null. It doesn’t throw a NamingException, which is what I’d expect if the JNDI name was incorrect.

Can anyone see what I’m doing wrong? The test code below outputs:

true
false

import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class JndiTest
{
    private final static String QUEUE_NAME = "jca:/org.apache.geronimo.configs/activemq-ra/JCAAdminObject/SendReceiveQueue";
    private final static String FACTORY_NAME = "jca:/org.apache.geronimo.configs/activemq-ra/JCAManagedConnectionFactory/DefaultActiveMQConnectionFactory";

    public static void main(String[] args) throws NamingException
    {
        InitialContext ctx = new InitialContext();
        QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup(FACTORY_NAME);
        Queue queue = (Queue)ctx.lookup(QUEUE_NAME);
        System.out.println(factory == null);
        System.out.println(queue == null);      
    }

}

In case it makes a difference: I’ve added openejb-client-3.0.1.jar, geronimo-ejb_3.0_spec-1.0.1.jar and activemq-core-4.1.2-G20090207.jar to my class path, and my jndi.properties file has the properties:

java.naming.factory.initial = org.apache.openejb.client.RemoteInitialContextFactory
java.naming.provider.url = ejbd://127.0.0.1:4201
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:18:04+00:00Added an answer on May 12, 2026 at 11:18 am

    The reason why it is not throwing an exception is that – there is a ClassLoadException that comes when the resource is accessed.

    And the reason why that is happening because the class : com.sun.jndi.url.jca.jcaURLContextFactory is being searched for by the ClassLoader called from ResourceManager.

    If you change the Factory name to some other name then you shall see the NamingException – but in the case of lookup , for Exceptions such as ClassNotFound/IllegalState – no exceptions are raised.

    The dependencies of ActiveMQ thus need to be analysed.
    Update1: One of the possible reasons is that the factory object can only be instantiated in a managed environment. Are you running your code as an application client?.

    Update2: Some other pointers found for the cause of this behavior:

    the openejb jndi implementation only
    exposes ejbs, not any other resources.
    If you have a j2ee app client, and
    you wish to use jms, you need to
    deploy a copy of the activemq adapter
    on the client. You can then use the
    j2ee java:comp/env context to find
    your stuff.

    Found this on ActiveMQ site:

    ActiveMQ’s JNDI Implementation does NOT talk to the naming server. It’s
    a stripped down version of a JNDI client that just allows to get Topics and
    Queues directly from a JMS instance. So, instead of supplying the naming server address, you have to supply the JMS server address.Most JNDI implementations use the java.naming.provider.url property to specify the naming server’s address. ActiveMQ uses the brokerURL one. Using the java.naming.provider.url one instead will result in ActiveMQ trying to load the whole Broker.

    See more on how to Connect using JNDI:

    The initial context factory used in the explanation is: org.apache.activemq.jndi.ActiveMQInitialContextFactory

    Some sample code to test with JNDI can be found here

    I wrote a simple java client – note below the provider url is the brokerURL that is being used.

        Properties props = new Properties();            
    props.put(Context.INITIAL_CONTEXT_FACTORY,
                 "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
        //props.put(Context.PROVIDER_URL,"vm://localhost");//Either this or below
        props.put(Context.PROVIDER_URL,"tcp://localhost:65432"); 
        props.put("queue.SendReceiveQueue",
             "org.apache.geronimo.configs/activemq-ra/JCAAdminObject/SendReceiveQueue");
          
        InitialContext context = new InitialContext(props);   
        QueueConnectionFactory connectionFactory = (QueueConnectionFactory)context.lookup
                                                                   ("ConnectionFactory");
        Queue q = (Queue) context.lookup("SendReceiveQueue");
        System.out.println("conn is : "  + connectionFactory.getClass().getName());
        System.out.println("queue is : " + q.getQueueName());
    

    This program gives the output:

    conn is : org.apache.activemq.ActiveMQConnectionFactory
    queue is : org.apache.geronimo.configs/activemq-ra/JCAAdminObject/SendReceiveQueue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 177k
  • Answers 177k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I had to add the index on all fields i… May 12, 2026 at 3:28 pm
  • Editorial Team
    Editorial Team added an answer There are two ways: You can crawl all pages on… May 12, 2026 at 3:28 pm
  • Editorial Team
    Editorial Team added an answer There isn't any, to my knowledge. If you look closely,… May 12, 2026 at 3:28 pm

Related Questions

I am trying to look up a QueueConnectionFactory and Queue via Geronimo's JNDI. The
I'm trying to use a feature of the Microsoft WinHttp library that has been
I know there is a StringIO stream in Python, but is there such a
Problem Statement: I would like to create an offline database to lookup prices/info on
This is my first time using C#, so I'm very much out of my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.