-
1. Give permission to write to a folder?
peterj Jan 27, 2011 1:21 PM (in response to brandx)A few questions come to mind:
1) Which version of JBoss AS, which version of Windows, and which version of the JVM?
2) How are you starting JBoss AS? Via the command line or as a service? If as a service, which mechanism are you using to register and run JBoss AS as a service?
3) Look in Task Managare and tell us the account used for the java.exe process. (You might have to add that column.)
4) Post the full stack trace for the exception you are getting.
5) Post the code snippet that is attempting the delete. Also post the values of any pertinent variables (such as the file name).
6) Have you run the delete code in a stand-alone Java app? Did it work there?
-
2. Re: Give permission to write to a folder?
brandx Jan 27, 2011 2:40 PM (in response to peterj)1) To be truthful, it's JBoss EWP 5.1 not the community edition (I didn't think that it might be a version specific issue, hence asking here. I do have a question out to our reseller as well). Win 7. Java 6 update 23.
2) I'm starting it on the command line.
3) JBoss is being run as myself (chris.williams). If I start it as an Administrator, then it's run as my Admin account.
4) There is no exception since java.io.File.delete() just returns a boolean rather than throwing an exception.
5) ->
String resFolder = getInitParameter("resources.folder");
if (request.getParameter("page_action") != null) {
if (request.getParameter("page_action").compareTo("delete") == 0) {
File f = new File(resFolder + request.getParameter("filename"));
if (!f.delete()) {
ServletOutputStream out = response.getOutputStream();
out.print("Couldn't delete");
out.close();
return;
}
response.sendRedirect("Resources.html");
return;
}
}
6) Yes, a standalone application is able to delete from the target folder, even while JBoss is still running. I also tried setting the scan folder for the servlet to C:\ and was able to delete a file there, just not a file from the target folder.
-
3. Re: Give permission to write to a folder?
peterj Jan 27, 2011 6:38 PM (in response to brandx)My only guess is that the file is use by something. Process Monitor from sysinternals could let you know if that is the case.
Exactly which file in ROOT.war are you trying to delete? Perhaps copy some other file to there, some file that would not be assumed to be part of the root web app, and see if you can remove that.
Also, where is EAP installed? Full path, please.
-
4. Re: Give permission to write to a folder?
brandx Jan 27, 2011 6:52 PM (in response to peterj)I created an empty (0 byte) file named test.txt. That's what I was trying to delete.
C:\jboss-ewp-5.1\jboss-as-web\server\default\deploy\ROOT.war\test.txt
It should never have thought that was a key file of the system.
-
5. Re: Give permission to write to a folder?
peterj Jan 28, 2011 2:02 PM (in response to brandx)What di you find out from Process Monitor?