wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes javax.naming .NameNotFoundException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "javax.naming .NameNotFoundException:" Watch "javax.naming .NameNotFoundException:" New topic
Author

javax.naming .NameNotFoundException:

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

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


Groovy
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

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:


[My Blog] [JavaRanch Journal]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

My client is running outside of JBoss. I tried as.It did not work.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

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
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

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

Joined: Feb 27, 2002
Posts: 8904

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

Joined: Feb 27, 2002
Posts: 8904

panacya-jms-ds.xml
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

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

Joined: Feb 27, 2002
Posts: 8904

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
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

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

Joined: Feb 27, 2002
Posts: 8904

It works but I am getting null object.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9932
    
159

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

Joined: Feb 27, 2002
Posts: 8904

Thanks. Now I have moved the client code inside of JBoss.
Tom Baker
Greenhorn

Joined: Jan 23, 2007
Posts: 1
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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javax.naming .NameNotFoundException:
 
Similar Threads
cmp on jboss-3.0.6_tomcat-4.1.18 with mysql
javax.naming.NameNotFoundException: javax.transaction.UserTransaction not bound
NameNotFoundException
Jboss rar JNDI lookup
Unable to push messages in JBoss-JMS queue