File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple RMI Question ...

 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1970
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you use policy file for your RMI server? If yes, make sure you allow connect and resolve.
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 959
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1585
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 959
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1585
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I'm just trying to start the RMI server
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic