Hey everyone
I’m having a problem passing a variable in RMI. This is for school, so there are some fairly strict requirements that I have to follow.
I have a
servlet that is the controlling servlet for the app this servlet is to use requestdispatcher to forward requests to the appropriate other servlet for processing.
One of the servlets gets a reference form the session to a remote object. This remote object has an instance of another non-remote object as one of its members. The remote object ‘RemoteCustomer’ has a method called setCurrentOrder(DinnerOrder order). The DinnerOrder object is a non-remote object. The RemoteCustomer just takes the passed in DinnerOrder and assigns it to an instance member.
I keep getting a java.rmi.UnmarshalException when I call the remote method setCurrentOrder.
I have declared the DinnerOrder class to implement serializable. Here is the class definition:
I added the read/writeObject because it didn’t work without them. However, it doesn’t work with them. Id didn’t think I had to do anything with the inner class because it only has primitive and Strings as members so they should serialize just fine. Do I need to specifically serialize each Dinner object in the Vector? I didn’t think so because Vector is serializable itself.
Here is the actual Exception as reported in
tomcat:
java.rmi.ServerException: RemoteException occurred in server
thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: Files/Apache
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: Files/Apache
java.net.MalformedURLException: no protocol: Files/Apache
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at RemoteCustomerImpl_Stub.setCurrentOrder(RemoteCustomerImpl_Stub.java:123)
at OrderServlet.doPost(OrderServlet.java:49)
I don’t understand the MalformedURLException unless that has something o do with the serialization process.
Any help would be greatly appreciated.
Thanks