JNDI lookup for a WebSphere application server resource could be tricky due to lots of client jar being required.
Below are few common exceptions you might run into during JNDI lookup from an external java client.
1. Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
Remedy: Make sure you place “Naming.jar” in the classpath
Location: WEBSPHERE_HOMEdeploytoolitppluginscom.ibm.websphere.v7_7.0.0.v20080817wasJars
2. Caused by: java.lang.ClassNotFoundException: com.ibm.ejs.ras.Tr
Remedy: Make sure you place “Ras.jar” in the classpath
Location : WEBSPHERE_HOMEdeploytoolitppluginscom.ibm.websphere.webservice.rt.v5.1.1_6.1.1.v200808141532lib
3. Caused by: java.lang.ClassNotFoundException: com.ibm.ws.exception.WsException
Remedy: Make sure you place “wsexception.jar” in the classpath
Location: WEBSPHERE_HOMEdeploytoolitppluginscom.ibm.websphere.webservice.rt.v5.1.1_6.1.1.v200808141532lib
4. Caused by: java.lang.ClassNotFoundException: com.ibm.ws.bootstrap.RASWsLoggerFacTory
Remedy: Make sure you place “Bootstrap.jar” in the classpath
Location: WEBSPHERE_HOME lib
5. Caused by: java.lang.ClassNotFoundException: org.eclipse.hyades.logging.events.cbe.impl.EventFactoryContext
Remedy: Make sure you place “com.ibm.jaxws.thinclient_7.0.0.jar” in the classpath
Location: WEBSPHERE_HOME runtimes
6. Exception in thread “main” javax.naming.ConfigurationException: The property com.ibm.ws.naming.wsn.factory.initial is not set or is not a string. The most likely cause is that the jar which contains the file com/ibm/websphere/naming/jndiprovider.properties cannot be found by the class loader.
at com.ibm.websphere.naming.WsnInitialContextFactory.initClass(WsnInitialContextFactory.java:145)
Remedy : Make sure you place “namingclient.jar” in the classpath
Location: WEBSPHERE_HOMEdeploytoolitppluginscom.ibm.websphere.v7_7.0.0.v20080817wasJars
7. Caused by: java.lang.ClassNotFoundException: com.ibm.CORBA.iiop.ORB
Remedy : Make sure you place “Ibmorb.jar” in the classpath
Location: WEBSPHERE_HOMEjavajrelib
For further troubleshooting classloader issues, please refer the below post:
https://weblogic-wonders.com/weblogic/2012/12/18/troubleshooting-classloader-issues-with-websphere/
Cheers,
Wonders Team 🙂
Awesome.. Thanks.
Thanks Mike. 🙂
Cheers,
Wonders team
Thank you so much. What a convoluted mess to use JNDI outside of WebSphere.