2

I'm running a java applet that is supposed to upload a picture to a website, the uploading fails and gives the following exception:

 java.security.AccessControlException: Access denied (java.net.SocketPermission 192.168.10.25 resolve)

And the backlog shows that the files SAXParserFactory and XMLParserConfiguration can not be found.

I've tried creating the crossdomain.xml file and granting open permissions but it didnt work. I've also added some mapping to the hosts file coz I thought it maybe the system can not map when access through the ip address but still no difference.

Any help?

ElderMael
  • 7,000
  • 5
  • 34
  • 53
  • I referred to this post http://stackoverflow.com/questions/4135138/access-denied-java-net-socketpermission-127-0-0-18080-connect-resolve – user1833567 Nov 18 '12 at 14:08
  • Is the applet digitally signed? Unless the JRE can sure the applet is 'phoning home' it will be refused in a sand-boxed applet. – Andrew Thompson Nov 19 '12 at 05:27
  • no it is not signed, do you have an easy way to sign them? – user1833567 Nov 19 '12 at 07:07
  • What is the hard way? [This demo.](http://pscode.org/jws/api.html#fs) has a build file that creates a certificate and digitally signs the code (using the tools in the SDK). – Andrew Thompson Nov 19 '12 at 07:35
  • I signed the jar file, but still getting the same error.I suspect that the website even felt a change. I replaced the jar file with the signed one and uploaded it to the server. Any help? – user1833567 Nov 20 '12 at 09:29
  • Were you prompted to accept the signed code? Where is the applet page, at what URL? – Andrew Thompson Nov 20 '12 at 09:43
  • I can't post the url because it's an internal website and no I wasn't prompted to accept the signed code.I verified that the jar is signed and the replaced the old jar with the signed one and restarted the servers.What step am I missing? – user1833567 Nov 20 '12 at 12:27
  • It's deplyed on WEB Sphere Application server 6 – user1833567 Nov 20 '12 at 12:49
  • *"I wasn't prompted to accept the signed code."* Then the browser does not yet know there is a new Jar. (Restart the browser) go to the [Java Console](http://www.java.com/en/download/help/javaconsole.xml) & type `x` to clear the class cache (or is it `c`? I always use them together). Then reload the applet and make sure you see [dialogs like this](http://stackoverflow.com/a/12986334/418556). – Andrew Thompson Nov 20 '12 at 23:23

1 Answers1

0

if it is an access restriction issue, try to put your code that access the file as follows;

AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            // privileged code goes here, for example:

        }
    });
dinukadev
  • 2,279
  • 17
  • 22