Discussions

Web tier: servlets, JSP, Web frameworks: ERROR: java.security.AccessControlException access denied

  1. I am trying to upload a file using "drag & drop" on applet which will communicate a servlet and upload that file(s) on the server.I have created a certificate and signed all jars with the help of this link http://java.sun.com/docs/books/tutorial/security/toolsign/step1.html and follow the same stpes but still getting the error ERROR: java.security.AccessControlException access denied (java.io.FilePermission C:\Documents and Settings\pvishwak\Desktop\Steps_applet.txt read) java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\pvishwak\Desktop\Steps_applet.txt 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.File.isFile(Unknown Source) at org.apache.commons.httpclient.methods.multipart.FilePartSource.(FilePartSource.java:67) at org.apache.commons.httpclient.methods.multipart.FilePart.(FilePart.java:129) at DropUploaderMulti.drop(DropUploaderMulti.java:100) at java.awt.dnd.DropTarget.drop(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer.access$800(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Unknown Source) at sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processDropTargetEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Plaese let me know where is the problem ?Am I doing some thing wrong? Prashant....
  2. if I am not wrong, Applets are not allowed to access resources (like files) on client (browser), this is done for security reason, other wise AppletVirus(cool name! huh...) can access your secured OS files and corrupt them.
  3. yes,you are right......But the question is still same.... How can I my applet access a file to upload that on the server ?Is there need to change another file to set read access.(because I changed java.policy file with grant codeBase "http://localhost:8080/FileDemo/jsp/appletstuff/-" { permission java.io.FilePermission "<>", "read"; permission java.io.FilePermission "<>", "write"; permission java.util.PropertyPermission "user.home", "read"; }; )but its now working....... Please help...........
  4. Make sure that your permission grant is ready properly. Run with -Djava.security.debug=all system property