I Have created a Signed applet for web based audio recorder, we are getting the security warning certificate, but the problem is still the applet is throwing the same security exception:
*"java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)".*
Below is the code I am using in the applet
1. TargetDataLine line = null;
2. AudioFormat format = new AudioFormat(8000.0F, 8, 1, true, true);
3. DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
4. line = (TargetDataLine) AudioSystem.getLine(info);
The exception is throwing at line number 5.
The code used for signing the applet is :: creates a keystore database and generates the keys: keytool -genkey -alias audiorecorder -keystore compstore -keypass secure -dname "cn=jones" -storepass audio
Sign the JAR File :: Code jarsigner -keystore compstore -storepass audio -keypass secure -signedjar SAudioRecorder.jar Audio_recorder.jar audiorecorder
I don’t know why this is happening after signing the applet.
What could be the problem here? Can anyone explain me as why this is happening? And how do I solve this problem?
Please provide the full stack trace.
I suspect some of the classes on the chain of calls leading to the exception does not originate from the signed jar.
As a rule, all of the classes on the stack must be signed or you must use AccessController.doPrivileged().
Another more tricky way is to execute the code in question on a separate thread (I prefer not).
Thanx in advance