Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Websphere and the fly likes JNDI Context problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI Context problem" Watch "JNDI Context problem" New topic

JNDI Context problem

Ram Kas
Ranch Hand

Joined: Jul 26, 2006
Posts: 83
When I try to do a lookup of JMS Queue , I get the following error:

Could not create JNDI API context: javax.naming.NoInitialContextException: Cannot instantiate class: [Root exception is java.lang.ClassNotFoundException:]

My Code is as follows:

Can any body let me know where I am going wrong? Do I need to set any classpath for it to work?

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

The jar containing this file seems to not be on your classpath:

Find that class, and you should be good.

-Cameron McKenzie
Ravi Nikam

Joined: Sep 28, 2007
Posts: 6
Which server version you are using there? if 6.1 then check properties might be you need this :

< !-- IBM ORB Properties -->
property name="org.omg.CORBA.ORBClass" value=""

else check for that perticular class and load thar JAR to classpath.

good luck ...
[ January 30, 2008: Message edited by: Ravi Nikam ]
Francesco Bellini

Joined: Nov 01, 2012
Posts: 26


I have this problem too, and I am trying to configure WAS 6 and 7 to use Apache ActiveMQ to create and use a Queue.
The code I am using is pretty similar to the one posted here in the first post, and I get an error when the code reaches this line:

This is the error:

The code above runs on Websphere where I have defined a QueueConnectionFactory and a Queue named "jms/systemMessageQueue" which exists on ActiveMQ (up and running).

I really don't understand why this happens, even if I tried to add the jar file to the classpath as suggested.

Can somebody help me please?
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
You need to add MQ client jars to your app classpath. You can find some MQ client jars inside the MQ connector in WebSphere at ${WEBSPHERE_HOME}/AppServer/installedConnectors the MQ libs are inside the .rar file called: wmq.jmsra.rar

Francesco Bellini

Joined: Nov 01, 2012
Posts: 26

Ok, it seems that it was a bug of activemq. The snapshot version 5.8.0 seems to be bug free as regard such problem.
It is sorta covered in the JavaRanch Style Guide.
subject: JNDI Context problem
Similar Threads
New To JMS
Jars required to run stanalone application for Websphere Application Server 5.0.1
Need info about servlet log file
jdeveloper look up error for jms