Solved

rmi: access denied (java.net.SocketPermission

Posted on 2002-03-15
3
2,323 Views
Last Modified: 2012-06-22
I met a rmi access denied exception. server works well, just that when client try to connect to server, we got this problem. exception as follows:
access denied (java.net.SocketPermission 155.69.149.78:10000 connect,resolve)

java.security.AccessControlException: access denied (java.net.SocketPermission 155.69.149.78:10000 connect,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.Socket.<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 MathExplorer1$panelPlot.paint(MathExplorer1.java:343)

     at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)

     at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)

     at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)

     at java.awt.Container.paint(Unknown Source)

     at sun.awt.RepaintArea.paint(Unknown Source)

     at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)

     at java.awt.Component.dispatchEventImpl(Unknown Source)

     at java.awt.Container.dispatchEventImpl(Unknown Source)

     at java.awt.Component.dispatchEvent(Unknown Source)

     at java.awt.EventQueue.dispatchEvent(Unknown Source)

     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

     at java.awt.EventDispatchThread.run(Unknown Source)
0
Comment
Question by:gordon_guan
3 Comments
 
LVL 9

Expert Comment

by:Venci75
Comment Utility
Are you using applet?
0
 

Accepted Solution

by:
maggari earned 15 total points
Comment Utility
1. Create a new security policy file. See your JDK docs or the links referenced from the Sun RMI tutorial for more information on this.

Sun RMI tutorial
http://java.sun.com/products/jdk/1.3/docs/guide/rmi/getstart.doc.html

2. When you run the client or the server, pass the location of your new security policy file in as an argument. This allows you to run under a new policy without having to modify your system policy files. Below is a .policy file that grants all permissions to everybody. DO NOT install this policy file in a production system. However, you can use it in trivial testing. You can then run the server with the command line
java -Djava.security.policy=<policy_filepath> myRMIServer
or the client with
java -Djava.security.policy==<policy_filepath> myRMIClient 127.0.0.1

0
 

Author Comment

by:gordon_guan
Comment Utility
well, I have solved(hope so) it myself, I just don't use the bat file to run the RMI server program and just run the rmiregistry and java command in two different windows and then it does give me no exception. But haven't tested with client program, so not sure whether can work with client correctly or not.
But any way, I think maggri does put in effort, so thanks a lot
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now