text: Q:
  
  java.security.AccessControlException: access denied exception on tomcat
  
  my program is working fine on local desktop but when i have deployed it on domain and run the same program then it is showing following exception.
  java.security.AccessControlException: access denied (java.net.SocketPermission www.abc.com:80 connect,resolve)
  
  at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
  
  at java.security.AccessController.checkPermission(AccessController.java:546)
  
  at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
  
  at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
  
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
  
  at sun.net.www.http.HttpClient.(HttpClient.java:233)
  
  at sun.net.www.http.HttpClient.New(HttpClient.java:306)
  
  at sun.net.www.http.HttpClient.New(HttpClient.java:323)
  
  at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:852)
  
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793)
  
  at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:718)
  
  at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:896)
  
  at pnr.PnrServlet.processRequest(PnrServlet.java:46)
  
  at pnr.PnrServlet.doGet(PnrServlet.java:81)
  
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
  
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
  
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  
  at java.lang.reflect.Method.invoke(Method.java:597)
  
  at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
  
  at java.security.AccessController.doPrivileged(Native Method)
  
  at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
  
  at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
  
  at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
  
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
  
  at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
  
  at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
  
  at java.security.AccessController.doPrivileged(Native Method)
  
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
  
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
  
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
  
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
  
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
  
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
  
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
  
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
  
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
  
  at java.lang.Thread.run(Thread.java:619)
  
  My program is to connect with other web site using java.net package 
  and show relevant data
  i am running this code on apache tomcat
  please  help me. 
  
  A:
  
  Tomcat on your local machine is probably running without security turned on. On the actual server this is not the case and security manager is active. It is possible to grant the required SocketPermission privileges for your application for example by putting the following into the Tomcat security policy file:
  grant codeBase "file:${catalina.base}/webapps/your_app_root/-" {
    permission java.net.SocketPermission "www.abc.com:80", "connect";
  };
  
  This should go into the policy file, which is normally under conf/catalina.policy but your installation may differ. You should replace the file: URI with the correct one for your case.
  Please also read the detailed documentation on Tomcat security manager here: http://tomcat.apache.org/tomcat-6.0-doc/security-manager-howto.html. 
  
  