You need to get the real file path. Use:

   getServletContext().getRealPath("/WEB-INF/")


Stephen

On Mon, Jul 18, 2011 at 12:37 PM, bb <[email protected]> wrote:

> Hello,
> I have a static XML file in my App Engine app that uploads just fine and I
> am trying to read it for some rules based execution logic, but the below
> error is thrown at me:
>
> Caused by: java.security.AccessControlException: access denied
> (java.io.FilePermission /war/WEB-INF/StaticContent.xml read)
> at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
> at
> java.security.AccessController.checkPermission(AccessController.java:553)
> at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
> at
> com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
> at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
> at java.io.FileInputStream.<init>(FileInputStream.java:130)
> at java.io.FileInputStream.<init>(FileInputStream.java:96)
>
> I tried placing the file both directly in the war and in the war/WEB-INF
> directories, the problem persists. The code on the server that attempts to
> read the file is as simple as this:
>
> final FileInputStream fis = new
> FileInputStream("/war/WEB-INF/StaticContent.xml");
>
> According to this article, I am doing everything correctly:
> http://code.google.com/appengine/kb/java.html#readfile
>
> Any help will be much appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine-java/-/TnMsvbMeBmoJ.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to