AccessControlException is thrown when a signed applet is trying to read a file from local system
Rnk msra
Greenhorn
Joined: Apr 02, 2009
Posts: 5
posted
0
Guys,
Please help me ..i am challenged...I am trying to read a .MIDI file,from an Applet(a signed one)
..I dont know where it is going wrong...
May be I might not be creating the policy file correctly or failing to access the URL...or point to policy file correctly...
Is there any way to skip creating policy files by using AccessController.doPrivileged()
here 's the stack trace..
java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\milind\GF1_P123 read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at com.sun.media.sound.RmfFileReader.getMidiFileFormat(Unknown Source)
at javax.sound.midi.MidiSystem.getMidiFileFormat(Unknown Source)
at org.jfugue.Player.loadMidi(Player.java:402)
at AccessDLLApplet.processMidi(AccessDLLApplet.java:143)
at AccessDLLApplet$2.run(AccessDLLApplet.java:78)
at AccessDLLApplet$2.run(AccessDLLApplet.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at AccessDLLApplet.loadMidiString(AccessDLLApplet.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.invoke.JSInvoke.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
I doubt , signing process that I am following is not correct .
Can you tell me the correct steps to sign an applet , I am also using Jfugue.jar capabilities in it.
Thanks in advance!
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
If you're using 3rd party libraries, then those need to be signed as well. The concrete steps are described in one of the pages linked from the page I mentioned above.
Rnk msra
Greenhorn
Joined: Apr 02, 2009
Posts: 5
posted
0
Hi Guys
Finally I got the solution ..!
I tried accessing my local resources through init() inside Applet , it worked . Any thread that you launch through init() will be able to access local resources. No need of using java.security.AccessController to get any extra privileges.
The most important thing is to keep all the relevant classes(third party jars etc) in a single jar and that should be signed properly.
Please correct me if am wrong.
Thanks for all your support.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
Good to hear you got things working.
The most important thing is to keep all the relevant classes(third party jars etc) in a single jar and that should be signed properly.
There's no need to put all classes into a single jar file - it's perfectly possible to use multiple jar files, as long as all of them are signed.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: AccessControlException is thrown when a signed applet is trying to read a file from local system