GeeCON Prague 2014*
The moose likes Distributed Java and the fly likes Simple RMI Question ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Simple RMI Question ..." Watch "Simple RMI Question ..." New topic
Author

Simple RMI Question ...

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

I'm totally new to RMI, I'm trying to run the server and I'm getting the following exception:

access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)

Can anybody tell me what can be the problem ?

Thanks in advance ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

is port 1099 open?
Is there a client listening to it?

RMI is all about client server communication. You have to have both a client and a server program running simultaneously, and you have to have your firewall set to all it.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Pat Farrell:
You have to have both a client and a server program running simultaneously


The original poster says they're just trying to run the server. Most client/server and similar topologies are quite happy to run the server with no clients. You often can't run a client without a server, but you usually can run a server without a client.

The "access denied" error looks more like trying to run the server in an environment where it's not allowed to do things like open ports. It's not an applet, is it? That's pretty unlikely to be allowed to open ports. Similarly, some application servers won't allow it.

What's the OS?


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Do you use policy file for your RMI server? If yes, make sure you allow connect and resolve.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

I'm using Windows XP, i have opened the port 1099 and also started the rmiregistry by saying start rmiregistry from the command line.

Is there another thing to start before running the server ?

Thanks in advance ...
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Actually if you use JDK 1.4 and above, you don't need to run rmiregistry anymore.

By the way, it seems to me that the problem is because of the SecurityManager. Inside your code, do you have something like:

If yes, you can try to remove it. If you set the SecurityManager, you need to specify the policy file, e.g. java -Djava.security.policy=server.policy WhateverClass
nd grant the permission for the SocketPermission.
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

I have removed that security part code and the exception is hidden now, but, another exception has risen

It's : Connection refused to host: 127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused: connect

What could be the problem ???

Thanks in advance ...
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Ooo at least, the SocketPermission exception is now gone

Are you trying to start the RMI server or trying to connect to the RMI server? It seems that you're trying to connect to RMI from your client. If that's the case, have you started the RMI server?
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
No I'm just trying to start the RMI server
 
Consider Paul's rocket mass heater.
 
subject: Simple RMI Question ...