Serialization/Marshalling problem
timfox Dec 8, 2005 5:56 AMI'm obviously doing something wrong but can't work it out, perhaps one of you guys can help me out.
I am attempting to send an Invocation (actually an org.jboss.aop.joinpoint.MethodInvocation) from client to server using remoting.
I'm just using Client.invoke to send the response:
InvocationResponse response = (InvocationResponse)client.invoke(mi, null);
Where mi is the MethodInvocation.
When the invocation reaches the ServerInvocationHandler - the argument values have been lost, actually the MethodInvocation has the correct number of arguments but the argument values are either null, (if the argument represents an Object not representing a primitive type), or a Long, Boolean etc. initialised with the default value of the corresponding primitive type.
The MethodInvocation definitely has the correct argument values on the call to Client.invoke.
I am using the "invocation" data type and InvocationMarshaller/UnMarshsaller, and JavaSerializationManager.
I'm working from HEAD.
In order to work around this problem instead of sending the MethodInvocation itself in the call to Client.invoke() I created a simple serializable object which contains the methodHash, argument array, and metadata for the invocation.
In the ServerInvocationHandler I then create a new MethodInvocation based on the data passed in the simple serializable object.
When I try this I get the following exception on the client side:
[junit] 10:53:23,488 ERROR [SocketClientInvoker] Got marshalling exception, exiting [junit] java.net.SocketException: Software caused connection abort: recv fai led [junit] at java.net.SocketInputStream.socketRead0(Native Method) [junit] at java.net.SocketInputStream.read(SocketInputStream.java:129) [junit] at java.io.BufferedInputStream.fill(BufferedInputStream.java:183 ) [junit] at java.io.BufferedInputStream.read(BufferedInputStream.java:201 ) [junit] at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStr eam.java:2133) [junit] at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInp utStream.java:2423) [junit] at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Objec tInputStream.java:2433) [junit] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java: 1245) [junit] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:3 24) [junit] at org.jboss.remoting.serialization.impl.java.JavaSerializationM anager.receiveObject(JavaSerializationManager.java:102) [junit] at org.jboss.remoting.marshal.serializable.SerializableUnMarshal ler.read(SerializableUnMarshaller.java:50) [junit] at org.jboss.invocation.unified.marshall.InvocationUnMarshaller. read(InvocationUnMarshaller.java:48) [junit] at org.jboss.remoting.transport.socket.SocketClientInvoker.trans port(SocketClientInvoker.java:246) [junit] at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInv oker.java:112) [junit] at org.jboss.remoting.Client.invoke(Client.java:244) [junit] at org.jboss.remoting.Client.invoke(Client.java:207) [junit] at org.jboss.jms.client.stubs.ClientStubBase.invoke(ClientStubBa se.java:100) [junit] at org.jboss.jms.client.stubs.ConnectionStub$sendTransaction_N49
and the following exception on the server side:
10:53:23,473 ERROR [ServerThread] failed java.lang.IllegalStateException: unread block data at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2261) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324) at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.j at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:50) at org.jboss.invocation.unified.marshall.InvocationUnMarshaller.read(InvocationUnMarshaller.java:48) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:268) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:330) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:188)
Any ideas?