尝试远程连接到Websphere上的JMS队列时出现sun/io/MalformedInputException [英] sun/io/MalformedInputException when trying to remotely connect to JMS queue on websphere

查看:112
本文介绍了尝试远程连接到Websphere上的JMS队列时出现sun/io/MalformedInputException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,(非常)

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.

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

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.

我正在使用Netbeans,并且正在使用JDK1.8. 此外,我还向库中添加了以下jar文件:

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  

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

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); 
}

这时(connectionFactory = ...),它失败而未触发捕获

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

我真的不确定在哪里可以解决此错误.是找到正确的.jar文件或库的情况,还是这里存在更大的问题?我确实是LAMP开发人员,而对Java和JMS队列世界的深入了解令人沮丧.

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.

非常感谢

推荐答案

Java 8中不存在类sun.io.MalformedInputException,并且不支持Java 8作为WebSphere Application Server v 8.5的客户端.请使用Java 6或7.

The class sun.io.MalformedInputException doesn't exist in Java 8, and also Java 8 is not supported as client to WebSphere Application Server v 8.5. Please use Java 6 or 7.

这篇关于尝试远程连接到Websphere上的JMS队列时出现sun/io/MalformedInputException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆