jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes RMI access denied Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "RMI access denied" Watch "RMI access denied" New topic

RMI access denied

Niko Prinz

Joined: Aug 16, 2012
Posts: 15

Heey guys

I have just start to use RMI and a get a some kind of a strange error

java.security.AccessControlException: access denied ("java.net.SocketPermission" "NK" "resolve")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getByName(Unknown Source)
at java.net.InetSocketAddress.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at EnterpriseProgramming.DisplayPerfectTime.main(DisplayPerfectTime.java:8)

Here is my code

can some one plzz help me to find the error thanks !!! ^^

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14991

That code is for the server part. You also have a class DisplayPerfectTime, which is the client part, which you didn't show us.

Are you running the client in an applet, or another environment which has restrictions? Applets run in a secure environment and can't do things like communicate over the network to any arbitrary server, or read and write files from and to the local filesystem.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link: http://aspose.com/file-tools
subject: RMI access denied
It's not a secret anymore!