Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI UnmarshalException

 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not post your policy file and let someone see if they can spot why it's having problems?
 
Dan Lynch
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
permissionssion

If that's a direct cut & paste from the file, that's your problem right there...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic