Applet/Servlet security

Posted on 2003-03-07
Medium Priority
Last Modified: 2013-11-24
I have a servlet/applet rmi communication example which gives me this messages:

Problem establishing server socket: java.security.AccessControlException: access denied (java.net.SocketPermission localhost:1313 listen,resolve)

It seems I need to set a security manager somewhere, but I'm having trouble finding out where and how exactly what I need to do to grant the socket permission.
Question by:Neoteric
  • 3
  • 2
LVL 35

Expert Comment

ID: 8091664
 You need to alter your policy file (java.policy) and give SocketPermission to localhost on port 1313 for listen and resolve. You have to do something like the following:

grant {
    permission java.net.SocketPermission "loclhost:1313", "listen,resolve";

Author Comment

ID: 8093310
Ok, thanks. Where should I put this file? Or where do I find it?
LVL 35

Accepted Solution

girionis earned 300 total points
ID: 8093459
 It is under your lib\security folder of where you installed java.

Author Comment

ID: 8093511
Great, I assume both applet and servlet need re-compiling under the new policy before uploading.
LVL 35

Expert Comment

ID: 8093707
 Thank you :-)

  No, recompilation is not needed. However you will need to restart your server in order for the servlets to be able to use the new policy file. Note that Tomcat might have its own policy file so you might need to change that one as well :-)

Featured Post

Industry Leaders: 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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

569 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