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
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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

764 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