aspose file tools*
The moose likes Distributed Java and the fly likes RMI UnmarshalException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI UnmarshalException" Watch "RMI UnmarshalException" New topic
Author

RMI UnmarshalException

Dan Lynch
Ranch Hand

Joined: May 16, 2003
Posts: 47
Hey,

Im trying to get an RMI program working, its just a simple one I downloaded, and when I try and run the server i am getting the following error.

Communication error java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.net.SocketException: Connection reset

I have changed the rmiregistry to use a different port as the default was already in use. Any help appreciated.

D
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Just to make sure... when you changed the rmiregistry port, you made sure to include the port in the string you are using to rebind() or bind() the server to the registry, right?

Also, it could be a general network issue... any firewall software running on the machine?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Dan Lynch
Ranch Hand

Joined: May 16, 2003
Posts: 47
Hey,

This is the main method where the bind is called. Im not sure if I should have changed this or not.


public static void main (String args[]) {

try {

/* Create an instance of the EUStatsServer
* object
*/
EUStatsServer statsServer = new EUStatsServer();

/* Put it in the Registry */
Naming.rebind("EUSTATS-SERVER",
statsServer);

}
/* If the URL-formatted argument to Naming.rebind
* is not legal...
*/
catch (java.net.MalformedURLException e) {
System.out.println("Malformed URL for EUStatServer "
+ e.toString());
}

/* If any communication failures occur... */
catch (RemoteException e) {
System.out.println("Communication error "
+ e.toString());
}
}
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

If you're running on a port other than the default 1099 you should use something like this to bind your server -


If you don't specify it, Naming just looks for the RMI registry running on 1099 on localhost.
Dan Lynch
Ranch Hand

Joined: May 16, 2003
Posts: 47
Thanks for the heko Nate. I did that and now Im getting a parsing error. Here it is

java -Djava.security.policy=EUStats.policy EUStatsClient England
java.security.policy: error parsing file:/var/www/html/java/Eu/EUStats.policy:
line 2: expected permission entry
Error in invoking object method java.rmi.NotBoundException: EUSTATS-SERVEREUSTATS-SERVER
java.rmi.NotBoundException: EUSTATS-SERVER
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:84)
at EUStatsClient.main(EUStatsClient.java:25)

Im not sure why it wont read the policy file.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Why not post your policy file and let someone see if they can spot why it's having problems?
Dan Lynch
Ranch Hand

Joined: May 16, 2003
Posts: 47
Here u go. It says there is a error in line 2.

grant{
permissionssion java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.net.SocketPermission "*:80", "connect";
};
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

permissionssion

If that's a direct cut & paste from the file, that's your problem right there...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: RMI UnmarshalException