• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

NoClassDefFoundError WsnInitialContextFactory com/ibm/ejs/ras/Tr

 
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also have in code:
properties.put(Context.PROVIDER_URL, "iiop://localhost:myCorrectRMIPortNumber");
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It's feeding time! Give me the food you were going to give to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic