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.