aspose file tools
The moose likes JBoss and the fly likes javax.naming .NameNotFoundException: Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "javax.naming .NameNotFoundException:" Watch "javax.naming .NameNotFoundException:" New topic
Author

javax.naming .NameNotFoundException:

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

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: 8146
    
  52

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: 8876

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

Joined: Jul 20, 2005
Posts: 8146
    
  52

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: 8146
    
  52

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: 8876

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: 8876

panacya-jms-ds.xml
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8146
    
  52

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: 8876

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: 8146
    
  52

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: 8876

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

Joined: Jul 20, 2005
Posts: 8146
    
  52

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: 8876

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?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: javax.naming .NameNotFoundException:
 
Similar Threads
javax.naming.NameNotFoundException: javax.transaction.UserTransaction not bound
Unable to push messages in JBoss-JMS queue
Jboss rar JNDI lookup
NameNotFoundException
cmp on jboss-3.0.6_tomcat-4.1.18 with mysql