Service Virtualization

 View Only
  • 1.  JNDI Queue Name Not Found

    Posted Apr 05, 2016 12:35 PM

    I've been struggling through trying to understand/figure out how to record a very simple JMS application that uses Apache ActiveMQ.


    With some help I received in my previous post I was able to get my JNDI Initial Context and JMS Connection Factory assets created.


    Now whenever I'm trying to create an asset for my JMS Destination, I get the following error ::

    Verifying Asset
    Opening JNDI context with URL: tcp://localhost:61616
    Performing JNDI lookup with name: queue.MyQueue
    Error: Object Queue JNDI Name: queue.MyQueue not found in JNDI context MyJNDIcontext




    My file looks like this ::

    java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory
    # use the following property to configure the default connector
    java.naming.provider.url = tcp://localhost:61616
    # use the following property to specify the JNDI name the connection factory
    # should appear as.
    connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
    # register some queues in JNDI using the form
    # queue.[jndiName] = [physicalName]
    queue.MyQueue = example.MyQueue
    # register some topics in JNDI using the form
    # topic.[jndiName] = [physicalName]
    topic.MyTopic = example.MyTopic



    Am I placing the wrong value in the "Queue JNDI Name" field?  It looks correct to me, but it's not working.

  • 2.  Re: JNDI Queue Name Not Found

    Posted Apr 05, 2016 12:52 PM

    Does a slash ("queue/MyQueue") work rather than a period ("queue.MyQueue") in your queue name?

    Also, check out the examples project located in your LISA_HOME/examples directory. 

    There is a JMS test step in the Tests folder.  There are some connection and queue assets defined in the project.config file.  These might help you some.

    On the basis of the connection properties in the config, you might also be able to set up a connection factory using JNP and org.jnp.interfaces.NamingContextFactory rather than ActiveMQ. 

  • 3.  Re: JNDI Queue Name Not Found

    Posted Apr 05, 2016 01:06 PM

    Or, "queue/example.MyQueue" based on properties file above.  Are the queues dynamicQueues?  If so, then "dynamicQueues/example.MyQueue" might be more appropriate.


    See the project located in LISA_HOME/Projects/Cars v9.  The DevTest queue definitions for the forward cars demo app are located there.    LISA_HOME/DemoServer/carsdemo/ contains the queue defs.  This too might give you some ideas.

  • 4.  Re: JNDI Queue Name Not Found
    Best Answer

    Posted Apr 05, 2016 01:06 PM

    If you want to access an ActiveMQ queue through JNDI then you need to use a special prefix.  For queues it's "dynamicQueues/", so for 'Queue JNDI Name' you should enter "dynamicQueues/queue.MyQueue".  This is something that's specific to ActiveMQ and it's "stub" JNDI implementation.


    Alternatively, you can use a 'JMS Queue' asset instead of 'JMS JNDI Queue'.  Rather than going through JNDI, the 'JMS Queue' asset looks up the queue directly through a JMS Session and does not require the full "dynamicQueues/..." JNDI path.  With ActiveMQ this is usually the way to go; its JNDI interface is just a very thin layer on top of direct JMS anyway.

  • 5.  Re: JNDI Queue Name Not Found

    Posted Apr 05, 2016 01:20 PM

    Thank you!

    I changed the "Queue JNDI Name" value to :: dynamicQueues/queue.MyQueue and it worked.


    NOTE :: I also tried the alternative suggestion by changing the "Class" to JMS Queue, but when I went to verify the asset, I got an error about not having a supported runtime.