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

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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic