I am aware that a (very) similar question has been asked elsewhere but there are no answers so am posting here in the hope the new post will trigger some valuable responses.
I am trying to create a standalone app that will interrogate a JMS queue that is running on websphere. The queues are running as local apps are able to communicate with it and there are messages sitting there waiting for me.
I am using Netbeans and am using JDK1.8. In addition I have added the following jar files to the library:
javax.jms-1.1.jar
com.ibm.ws.orb_8.5.0.jar
com.ibm.ws.ejb.thinclient_8.5.0.jar
The latter two were copied from the websphere installation.
Here is a summary of the initial code (it is actually built in a class with methods for the context and factory bits so have modified it to show here):
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, corbaloc:iiop:192.168.254.202:2809);
try{
InitialContext jndiContext = new InitialContext(env);
}catch(NamingException e){
System.out.println("ERROR: Could not create JNDI context: " + System.lineSeparator() + e.toString());
System.exit(1);
}
ConnectionFactory connectionFactory= (ConnectionFactory) this.jndiContext.lookup(factory);
String outFactory = "jndi/OUTConnectionFactory";
try{
connectionFactory = (ConnectionFactory) jndiContext.lookup(outFactory);
}catch(Exception e){
System.out.println("ERROR: Could not create factory connection:");
System.out.println(e.toString());
System.exit(2);
}
At this point (connectionFactory = ...) it fails without triggering the catch
Exception in thread "P=598328:O=0:CT" java.lang.NoClassDefFoundError: sun/io/MalformedInputException
at com.ibm.rmi.iiop.CDRReader.getTcsCConverter(CDRReader.java:398)
at com.ibm.rmi.iiop.CDRReader.readStringOrIndirection(CDRReader.java:479)
at com.ibm.rmi.iiop.CDRReader.read_string(CDRReader.java:465)
at com.ibm.rmi.IOR.read(IOR.java:335)
at com.ibm.rmi.iiop.Connection._locate(Connection.java:480)
at com.ibm.rmi.iiop.Connection.locate(Connection.java:439)
at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:219)
at com.ibm.rmi.corba.Corbaloc.locateUsingINS(Corbaloc.java:307)
at com.ibm.rmi.corba.Corbaloc.resolve(Corbaloc.java:378)
at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3721)
at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3256)
at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3619)
at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1645)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1502)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:1040)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:962)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:614)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:128)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:765)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at jmstool2.JmsConn.CreateFactCon(JmsConn.java:103)
at jmstool2.JmsConn.connect(JmsConn.java:59)
at jmstool2.Jmstool2.main(Jmstool2.java:21)
Caused by: java.lang.ClassNotFoundException: sun.io.MalformedInputException
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 25 more
Java Result: 1
I am really not sure where to look to resolve this error. Is it a case of finding the right .jar file or library or are there bigger issues at play here? I am a LAMP developer really and this dive into the world of Java and JMS queues is proving rather frustrating.
Many thanks