File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes Need Help - How to access JMS Administered objects created in WAS 6.1 from Servlet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Need Help - How to access JMS Administered objects created in WAS 6.1 from Servlet ?" Watch "Need Help - How to access JMS Administered objects created in WAS 6.1 from Servlet ?" New topic
Author

Need Help - How to access JMS Administered objects created in WAS 6.1 from Servlet ?

Priyadarshan Kelkar
Ranch Hand

Joined: Apr 04, 2007
Posts: 31
I have WAS 6.1 installed on my machine. My workspace is in Eclipse. I have not integrated Eclipse with WAS 6.1. I want to create and EAR file and deploy on WAS 6.1. Currently I am deploying on Tomcat 6.0 server.
I have created JMS Administered objects such as ConnectionFactory, Queue etc. in WAS 6.1. Now in my servlet code I want to access these object through JNDI lookup. My lookup code is:

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,"iiop://localhost:2809");
Context jndiContext = null;
try {
jndiContext = new InitialContext(env);
} catch (NamingException e) {
System.out.println("Could not create JNDI API context: " + e.toString());
}


But I keep on getting the exception:

java.lang.NoClassDefFoundError: com/ibm/ws/bootstrap/RASWsLoggerFactory
com.ibm.websphere.naming.WsnInitialContextFactory.<clinit>(WsnInitialContextFactory.java:70)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
javax.naming.InitialContext.init(Unknown Source)
javax.naming.InitialContext.<init>(Unknown Source)
com.bnymellon.jms.MyJMSServlet.doGet(MyJMSServlet.java:39)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.ClassNotFoundException: com.ibm.ws.bootstrap.RASWsLoggerFactory
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
com.ibm.websphere.naming.WsnInitialContextFactory.<clinit>(WsnInitialContextFactory.java:70)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
javax.naming.InitialContext.init(Unknown Source)
javax.naming.InitialContext.<init>(Unknown Source)
com.bnymellon.jms.MyJMSServlet.doGet(MyJMSServlet.java:39)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)



I have following jars in my WEB-INF/lib

1) com.ibm.mq.jar
2) com.ibm.mqjms.jar
3) com.ibm.ws.admin.client_6.1.0.jar
4) com.ibm.ws.runtime_6.1.0.jar
5) com.ibm.ws.webservices.thinclient_6.1.0.jar
6) dhbcore.jar
7) ibmorb.jar
8) jms.jar
9) ws_runtime.jar
10) servlet-api.jar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help - How to access JMS Administered objects created in WAS 6.1 from Servlet ?