File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes RMI Server help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI Server help please" Watch "RMI Server help please" New topic

RMI Server help please

Scott Paananen

Joined: Jan 07, 2009
Posts: 2
I'm new to RMI and I am having problems starting my server within netbeans 6.5.

When I run the server, I get this exception in my output window:


There was an error with the Binding:access denied ( connect,resolve) access denied ( connect,resolve)
at java.lang.SecurityManager.checkPermission(
at java.lang.SecurityManager.checkConnect(
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(
at sun.rmi.transport.tcp.TCPChannel.createConnection(
at sun.rmi.transport.tcp.TCPChannel.newConnection(
at sun.rmi.server.UnicastRef.newCall(
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(
at rmitests.HelloImpl.main(

here is the code in the file

I believe that it is not using my policy file. So what I would like to know is first, is it possible to set up the policies in code using or is there a way to point netbeans to my policy file when it runs.

I've gone into the properties of the project, then run and added this to the arguments:\mysrc\policy.policy

but that doesn't seem to make a difference.
Can someone please help me.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46360
That's more complicated than we usually discuss here in beginner's. Moving.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Did you start the RMI server before you attempted to run the HelloImpl program?

If yes, then try to run the HelloImpl program directly from a command line. Once you get this working correctly, then you can try to learn how to do it within the NetBeans IDE tool.

If no, then you need to have a RMI server running before attempting to bind objects in the server's registry.

The code you posted is not a RMI server. An RMI server is a separate application that is written already, you do not write the code of the server. You write applications that USE an RMI server for distributed processing.

Nitesh Kant

Joined: Feb 25, 2007
Posts: 1638

Since, you are enabling security manager, you need to give connect/resolve socket permission for the registry port. I think you have not done so that is why it is giving you an access denied error.
If you do not know how to specify permissions in java, this article will get you started.

apigee, a better way to API!
I agree. Here's the link:
subject: RMI Server help please
It's not a secret anymore!