Sun / io / MalformedInputException when trying to remotely connect to a JMS queue on a web page

I know that the question was (very) asked elsewhere, but there are no answers, so post here in the hope that the new post will cause some valuable answers.

I am trying to create a standalone application that will interrogate a JMS queue running on websphere. The queues are running, because local applications can communicate with him, and there are waiting for messages that are waiting for me.

I am using Netbeans and using JDK1.8. In addition, I 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 last two copies were copied from the websphere installation.

Here is a summary of the source code (it is actually built in a class with methods for context and factory bits, so 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); 
}

(connectionFactory =...) , 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

, . .jar ? LAMP, Java JMS- .

+4
1

sun.io.MalformedInputException Java 8, Java 8 WebSphere Application Server 8.5. , Java 6 7.

+7

Source: https://habr.com/ru/post/1570874/


All Articles