当我通过EJB接口查询实体时,在控制台下可以,但是从Swing切换到查询会抛出此异常。
例外:
java.rmi.UnmarshalException: failed to unmarshal MY_ENTITY****; nested exception is:
java.io.StreamCorruptedException: invalid type code: 00
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:219)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:224)
at ***.****_6ndxy4_EOImpl_922_WLStub.getProductInformation(Unknown Source)
at MY_CLASS****.getProductInformation(*****.java:460)
at ******$5.run(OrigBlotter.java:318)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.StreamCorruptedException: invalid type code: 00
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1642)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:217)
答案 0 :(得分:6)
事实证明这是一个JRE错误。 因为我的控制台env是1.5而swing是1.6:
错误参考: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6554519 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434149
我们需要将此arguemnt传递给JVM
-Dsun.lang.ClassLoader.allowArraySyntax =真
答案 1 :(得分:0)
当与JVM找到的序列化对象相对应的类与序列化类具有相同的serialVersionUid时,会生成此异常,但实际上是不同的版本(即:在不更改版本的情况下对类进行了更改) ID)。
检查类路径中是否有相关的jar / class文件?