Can't open text file in war folder, AccessControlException thrown?

閲覧: 0 回
最初の未読メッセージにスキップ

user291701 via StackOverflow

未読、
2013/05/16 11:31:302013/05/16
To: google-appengin...@googlegroups.com

I have a foo.txt file in my /war folder. I'm trying to open it using the File class, but get an exception:

java.security.AccessControlException: access denied (java.io.FilePermission
  /foo.txt read)
  at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
  at java.security.AccessController.checkPermission(AccessController.java:549)
  ...

From reading the docs on static/resource files, it seems like the text file should already be available. Does it need some extra setting to allow reading?:

https://developers.google.com/appengine/docs/java/config/appconfig?hl=en#Static_Files_and_Resource_Files

I'm using the local dev server on a mac.

Thanks



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/16591618/cant-open-text-file-in-war-folder-accesscontrolexception-thrown

Romin via StackOverflow

未読、
2013/05/16 12:41:362013/05/16
To: google-appengin...@googlegroups.com

I suggest that if you are going to read data files in your Java code and need a place to put your data files (.txt or .csv), etc -- then do the following:

  • Go to WEB-INF folder
  • Create some folder inside of the WEB-INF folder. e.g. WEB-INF\data
  • Place your files in the above folder. E.g. sample.txt
  • In your Java IO code, you can then refer to the file via WEB-INF\data\sample.txt


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/16591618/cant-open-text-file-in-war-folder-accesscontrolexception-thrown/16592969#16592969
全員に返信
投稿者に返信
転送
新着メール 0 件