I'm running Tomcat 4. I've written an applet which talks to a servlet: URL myConnection = new URL("http://joelhost:8080/portfolio/servlet/ + testsend); URLConnection myConn = myConnection.openConnection(); It works fine when I run it the same machine (A). But when I try to run the applet from machine (B), I get the following messages: java.security.AccessControlException: access denied (java.net.SocketPermission joelhost:8080 connect,resolve) at java.security.AccessControlContext. checkPermission (AccessControlContext.java:270) at java.security. AccessController. checkPermission (AccessController.java:401) at java.lang. SecurityManager. checkPermission (SecurityManager.java:542) at java.lang. SecurityManager. checkConnect (SecurityManager.java:1044) at sun.plugin. net.protocol.http. HttpURLConnection. checkPermission (HttpURLConnection. java:203) at sun.plugin.net. protocol.http. HttpURLConnection.connect (HttpURLConnection.java:147) at sun.plugin. net.protocol. http.HttpURLConnection. getInputStream (HttpURLConnection. java:375) at portfolio. acctSetup.<init> (acctSetup.java:154) at myApp.jbInit (myApp.java:76) at myApp.init (myApp.java:40) at sun.applet. AppletPanel.run (AppletPanel.java:347) at java.lang.Thread.run (Thread.java:536) I've made the following entry in catalina.policy grant codeBase "file:${catalina.home}/webapps/portfolio + /WEB-INF/classes/-" { permission java.net.SocketPermission "joelhost", "connect"; Any ideas out there?
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
hi Joel,
I've made the following entry in catalina.policy
but are not these changes applied to only the local machine where the tomcat is running? in that case it will replace only local java.policy file where the tomcat is residing but if you want to access the applet from another machine then the java.policy file on THAT machine (from where you are running the applet) should be changed to grant the permissions, right?? please let me know if i misunderstood your question or sound dumb on the X'Mas morning regards maulin
I don't think I should have to change the Java policy file on machine B. Anyway, I've put the problem aside for now. I'm developing the program using JSP's and servlets instead of applets. Keeps it thinner.
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
hi joel,
i thought so because its the local machine who is trying to run the applet. so it must be the local machine adminstrator who should be able to specify the access rights etc you know. catalina.policy is a server side configuration , right? so server A can't say that on Machine B some applet can do "delete *.*" you know please let me know when you found a solution to your problem. i'm more interested because i have never used (or didn't know about catalina.policy file till this moment) catalina.policy file.... regards maulin
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
hi Joel, any progress on the issue? thanks maulin
Ali Sha
Greenhorn
Joined: Mar 15, 2004
Posts: 2
posted
0
Dear Maulin: I saw your respond to Joel and I decided to ask you to help us; if an applet,which is deployed on Server1 and a client of Server1 access that applet, on a certain condition this applet invokes a servlet from Server2(remember applet is deployed on server1) then a scoket exception occures... following is the code of applet which is deployed on Server1 try { URL dataURL = null; URLConnection connection = null; dataURL = new URL("http://Server2:8080/cFAS/servlet/ServletOpnControl"); System.out.println("...." + dataURL.toString()); connection = dataURL.openConnection(); ObjectInputStream in = new ObjectInputStream(connection.getInputStream()); String[] data1 = (String[]) in.readObject(); in.close(); } catch (Exception mue) { System.out.println("exc..."+mue); } here is the exception: java.security.AccessControlException: access denied (java.net.SocketPermission Server2:8080 connect,resolve) Thanks in advance