• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javax.naming .NameNotFoundException:

 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have integrated ActiveMQ. ActiveMq connectionfactory has been bound to the JNDI name 'java:activemq/QueueConnectionFactory'.

11:21:03,670 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding
,name=activemq/QueueConnectionFactory' to JNDI name 'java:activemq/QueueConnectionFactory'


In the client I am trying to do the JNDI lookup of the connection factory.

ic = new InitialContext();
cf = (ConnectionFactory)ic.lookup("activemq/QueueConnectionFactory");

I am getting


I am going
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question: When you say 'client' is it a standalone client? If yes then the java namespace of the server wont be visible to this client.

The other part, instead of the code below:

ic = new InitialContext();
cf = (ConnectionFactory)ic.lookup("activemq/QueueConnectionFactory");


Try this out:
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My client is running outside of JBoss. I tried as.It did not work.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alternately, you can try the following:

- Go to http://localhost:8080/jmx-console
- You will find service=JNDIView
- Click on it
- On the page that comes up, click on the Invoke button next to the 'list' method
- The next page that comes up will display the jndi names and the corresponding objects bound to the JNDI
- In this list of jndi names check where your object is bound
- If you are not able to decipher the contents of the JNDI tree, post the output here.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

My client is running outside of JBoss.



That explains it. The java:/ namespace will NOT be visible to a standalone client.

How have you configured the ActiveMQ ConnectionFactory? Can you post the configuration file
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am seeing it under java: Namespace

+- activemq (class: org.jnp.interfaces.NamingContext)
| +- QueueConnectionFactory (class: org.apache.activemq.ra.ActiveMQConnectionFactory)
| +- TopicConnectionFactory (class: org.apache.activemq.ra.ActiveMQConnectionFactory)

Should it be under global JNDI Namespace?
[ August 30, 2006: Message edited by: Pradip Bhat ]
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
panacya-jms-ds.xml
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Should it be under global JNDI Namespace?



Yes, to make it visible to the standalone client(which is outside the server JVM) you will have to configure the jndi name in the global namespace. While configuring the ConnectionFactory, you can do it in the xml file.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jaikiran pai:


Yes, to make it visible to the standalone client(which is outside the server JVM) you will have to configure the jndi name in the global namespace. While configuring the ConnectionFactory, you can do it in the xml file.



How I do that in the above xml file.Thanks for your help so far.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Pradip Bhat:



Try this one:



I guess, you wont get the NameNotFoundException after this change, but you might observe that the object that is returned is null(not sure though).
Let us know about the outcome.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works but I am getting null object.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

It works but I am getting null object.



These links might help:

JBoss JCA Forum

Getting null when doing a lookup on ConnectionFactory?

These links mention the reason why the Connection factory is not available outside the app server
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Now I have moved the client code inside of JBoss.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there an option to run this from a standalone application however? What if the client code cannot run in the same JBoss container where active-mq is deployed?
 
Slime does not pay. Always keep your tiny ad dry.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic