简体   繁体   中英

Got “javax.ejb.EJBException: error unmarshalling arguments java.io.EOFException” when calling an ejb method

I am running an ejb method belongs to a EJB located in weblogic 10.3.6 server. This server is located in a Solaris-10 64bit machine. EJB client is located in Windows XP 32bit machine.

When I am executing this ejb method (inside a junit test case), I get this strange exception. I googled several times thinking about different reasons, but I am still unable to find a solution for this.

I checked the source code of java.io.DataInputStream and this java.io.DataInputStream.readInt() method throws this exception if this input stream reaches the end before reading four bytes.

Does any of you have an idea about this issue? thanks in advance.

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)

The reason for this problem was, my Eclipse IDE was using an old version of the api.jar file from its cache. :/

Since the problem occur in a readExternal method, you have probably a matching writeExternal method.

You should check the writeExternal to see if you are writing the same amount of stuff than you are trying to read. It may lack a writeInt() call.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM