调用ejb方法时得到“javax.ejb.EJBException:错误解组参数java.io.EOFException”

时间:2013-06-14 09:00:31

标签: java serialization ejb weblogic solaris

我正在运行属于位于 weblogic 10.3.6 服务器中的EJB的ejb方法。此服务器位于 Solaris-10 64位计算机中。 EJB客户端位于 Windows XP 32位计算机中。

当我执行这个ejb方法时(在junit测试用例中),我得到了这个奇怪的异常。我用Google搜索了几次考虑不同的原因,但我仍然无法找到解决方案。

我检查了 java.io.DataInputStream 的源代码,如果此输入流到达末尾,则此 java.io.DataInputStream.readInt()方法会抛出此异常在读取四个字节之前。

你们是否对这个问题有所了解?提前谢谢。

javax.ejb.EJBException: error unmarshalling arguments; nested exception is: 
    java.io.EOFException; nested exception is: java.io.EOFException
java.io.EOFException
    at java.io.DataInputStream.readInt(DataInputStream.java:375)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2775)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:949)
    at com.company.product.ClassDomain.readExternal(ClassDomain.java:356)
    at com.company.product.ClassDomainChild.readExternal(ClassDomainChild.java:129)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:208)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:599)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:204)
    at com.company.product.ProductFacadeSessionBeanWithAffinity_c8b15i_ProductFacadeSessionRemoteWithAffinityImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
javax.ejb.EJBException: error unmarshalling arguments; nested exception is: 
    java.io.EOFException; nested exception is: java.io.EOFException
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:121)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:96)
    at $Proxy7.createApplicationInstance(Unknown Source)
    at tools.actions.InitTest_CreateDomain.performInit(InitTest_CreateDomain.java:94)
    at com.company.tools.TestUtils.registerInitAction(TestUtils.java:114)
    at com.company.tools.TestUtils.createDomain(TestUtils.java:607)
    at com.company.product.test.Provisioner.provisionProfiles(Provisioner.java:388)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
    at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
    at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
    at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
    at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
    at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
    at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
    at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
    at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
    at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
    at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
    at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.io.EOFException
    at java.io.DataInputStream.readInt(DataInputStream.java:375)
    at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2775)
    at java.io.ObjectInputStream.readInt(ObjectInputStream.java:949)
    at com.company.product.ClassDomain.readExternal(ClassDomain.java:356)
    at com.company.product.ClassDomainChild.readExternal(ClassDomainChild.java:129)
    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1791)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:208)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:599)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:204)
    at com.company.product.ProductFacadeSessionBeanWithAffinity_c8b15i_ProductFacadeSessionRemoteWithAffinityImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:667)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:522)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:518)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:

221)

2 个答案:

答案 0 :(得分:1)

出现此问题的原因是,我的Eclipse IDE在其缓存中使用了旧版本的api.jar文件。 :/

答案 1 :(得分:0)

由于问题发生在readExternal方法中,您可能有匹配的writeExternal方法。

你应该检查writeExternal,看看你写的东西是否与你想读的东西相同。它可能缺少writeInt()电话。