Solved

rmi: access denied (java.net.SocketPermission

Posted on 2002-03-15
3
2,332 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groovy example issue 10 89
eclipse argument 14 53
fibonacci ten numbers 4 24
javap not working 8 36
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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

919 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

14 Experts available now in Live!

Get 1:1 Help Now