Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RMI: Naming.bind raises AccessControlException

4 views
Skip to first unread message

Roland Zumkeller

unread,
May 27, 2000, 3:00:00 AM5/27/00
to
Hi,
I'm trying to use RMI, but encountering problems when trying to
bind an object to a port.

I first start the registry with this command (at the
command prompt):
start rmiregistry 2005

Then execute the following code:
System.setSecurityManager(new RMISecurityManager());
MyRMIclass r = new MyRMIclass();
Naming.bind("//deep_thought:2005/MyRMIclass", r);

What I get is a java.security.AccessControlException on the bind
method. (Below you can find the whole stacktrace.)
The name of my machine is DEEP_THOUGHT, I'm using NT4 and JDK
1.2.1.

Thank you for your help.

Roland

java.security.AccessControlException: access denied
(java.net.SocketPermission deep_thought resolve)
at
java.security.AccessControlContext.checkPermission(Compiled Code)
at
java.security.AccessController.checkPermission(Compiled Code)
at java.lang.SecurityManager.checkPermission(Compiled
Code)
at
java.lang.SecurityManager.checkConnect(SecurityManager.java:1004)
at java.net.InetAddress.getAllByName0(Compiled Code)
at
java.net.InetAddress.getAllByName0(InetAddress.java:544)
at java.net.InetAddress.getByName(Compiled Code)
at java.net.Socket.<init>(Socket.java:98)
at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDi
rectSocketFactory.java:29)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Compi
led Code)
at
sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:462)
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java
:194)
at
sun.rmi.transport.tcp.TCPChannel.newConnection(Compiled Code)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown
Source)
at java.rmi.Naming.bind(Naming.java:116)
at MyRMIclass.main(MyRMIclass.java:24)

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!


Andrew

unread,
May 29, 2000, 3:00:00 AM5/29/00
to
Hello,

You must configure the necessary Java security permissions using a Java
policy file in Java 1.2 or later. The AccessControlException occurs when a
resolve is attempted in the Socket code. The JRE installation policy file
defining the security policy for all Java applications ) exists in
~jre/lib/security/java.policy - but an application may use a specific
security policy.

Permissions are of the form:

permission java.net.SocketPermission "localhost:2005", "listen, resolve"

Security in Java 1.2 is involved - its best to consult the tutorial -
http://java.sun.com/docs/books/tutorial/security1.2/tour2/step3.html

Roland Zumkeller <roland.zumke...@web.de.invalid> wrote in message
news:134a5b46...@usw-ex0104-028.remarq.com...

0 new messages