File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AccesscontrolException

 
rajani adapa
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WHen i run my server in the rmi program iam getting an error message saying,
java.security.AccessControlException: access denied (java.net.SocketPermission 1
27.0.0.1:1099 connect,resolve)
I've no idea what is going on over there.
Can anybody help me
please........
rajini
 
Fredrik Safstrom
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajini,
Try adding upp the following lines in your {Java Home}\jre\lib\security\java.policy file:
// Special permission for RMI.
permission java.net.SocketPermission "*", "connect";
permission java.net.SocketPermission "*", "accept";
Your file should then look something like this:

You also have to start the rmiregistry in a second dos-prompt (or second shell on unix). Just start a new dos-prompt and type rmiregistry.
/Bamse
 
rajani adapa
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you .
It's working now.
And i 've one more question.
IAm trying to use bean in my client program.
When iam trying to include all three files in a single package as,package mypkg;
in all three files of my rmi application,Neither of my server and client not accessing the interface.
What is the problem?
please correct me if iam wrong
rajini
 
rajani adapa
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry ,
Oops!! I FORGOT TO INCLUDE THE PACKAGE IN SPECIFIED DIRECTORY.
sORRY FOR THE INCONVENIENCE.
And now i got it's working fine.
Once again thanku very much
rajini
 
chr rosa
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are the security implications of adding
// Special permission for RMI.
permission java.net.SocketPermission "*", "connect";
permission java.net.SocketPermission "*", "accept";
to {Java Home}\jre\lib\security\java.policy file
That is, while it is necessary to make the aforementioned
modifications in order to activate the rmi service
functionality, is there any danger
in terms of overall security on the Unix server.
Thanks for your thoughts.
Best regards
 
sreenath reddy
Ranch Hand
Posts: 415
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using tomcat as my webserver and i am facing the problem while viewing the applet in IE . Its giving the exception saying java.security.AccessControlException:access denied ....But the same works fine when i use an IDE like eclipse for running the same applet

I tried editing the java policy file and even the catalina (Tomcat's policy file) by adding

permission java.net.SocketPermission "*", "connect";
permission java.net.SocketPermission "*", "accept";

But still i am getting the same error . Can any one let me know why this is still coming ??
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet will run differently in Eclipse vs. Tomcat because (most likely) Eclipse is using AppletViewer to run the applet - AppletViewer is like a "test environment" to quickly test your applet and make sure it is working without going through deploying the applet to a webserver, etc. One of the main things AppletViewer "skimps on" is the applet sandbox - this is why you are getting an AccessControlException. Changing Tomcat's policy file isn't going to help you here - the applet is really running in the client's browser, not Tomcat.

Read up on the "Applet Sandbox". Of primary interest is this - " It cannot make network connections except to the host that it came from."

If you really need to do whatever you're doing to cause the AccessControlException, you'll need to make a signed applet.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way - this really should have been a new post, rather than added on to the existing thread... and it should have been in the "Applets" forum...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic