Solved

rmi: access denied (java.net.SocketPermission

Posted on 2002-03-15
3
2,363 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:Venci75
ID: 6867549
Are you using applet?
0
 

Accepted Solution

by:
maggari earned 15 total points
ID: 6867774
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
ID: 6868015
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

737 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