• Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError WsnInitialContextFactory com/ibm/ejs/ras/Tr  RSS feed

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a very well known question.
I try to call datasource from a POJO.

My code is:

Hashtable properties = new Hashtable();

properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

Context context = new InitialContext(properties);
DataSource ds = (DataSource) context.lookup("jdbc/myDS");

Line: Context context = new InitialContext(properties); throws Exception as shown below:

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/ejs/ras/Tr at com.ibm.websphere.naming.WsnInitialContextFactory.<clinit>(WsnInitialContextFactory.java:68).null(Unknown Source)

I have following jar files in build path of the project in following sequence:

idl.jar, iwsorb.jar,j2ee.jar,naming.jar, namingclient.jar,rt.jar, additinal jars in WebSphere v5.1JRE.

Do I need additional jar files?

There is no good documentation on the required jar files.
 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also have in code:
properties.put(Context.PROVIDER_URL, "iiop://localhost:myCorrectRMIPortNumber");
 
Tony Chen
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sam Gehouse:

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/ejs/ras/Tr at com.ibm.websphere.naming.WsnInitialContextFactory.<clinit>(WsnInitialContextFactory.java:68).null(Unknown Source)


You also need WAS_HOME/lib/ras.jar

Also following jar files might be required as well:

ecutils.jar
ffdc.jar
idl.jar
implFactory.jar
iwsorb.jar
j2ee.jar
naming.jar
namingclient.jar
namingserver.jar
ras.jar
tx.jar
txPrivate.jar
utils.jar
wsexception.jar

HTH
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!