尝试远程连接到websphere上的JMS队列时,sun / io / MalformedInputException

我知道有一个(非常) similar question已被问到其他地方,但没有答案,所以我发布在这里希望新帖子会引发一些有价值的回应.

我正在尝试创建一个独立的应用程序,它将询问在websphere上运行的JMS队列.队列正在运行,因为本地应用程序能够与它通信,并且有消息在那里等着我.

我正在使用Netbeans并使用JDK1.8.
另外我已经将以下jar文件添加到库中:

javax.jms-1.1.jar
com.ibm.ws.orb_8.5.0.jar
com.ibm.ws.ejb.thinclient_8.5.0.jar

后两者是从websphere安装中复制的.

以下是初始代码的摘要(它实际上是在一个类中构建的,具有上下文和工厂位的方法,因此修改了它以显示在这里):

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队列的世界正在证明相当令人沮丧.

非常感谢

Java 8中不存在类sun.io.MalformedInputException,并且不支持Java 8作为WebSphere Application Server v 8.5的客户端.请使用Java 6或7.
相关文章
相关标签/搜索