2 Replies Latest reply on Jan 10, 2008 5:14 PM by s k

    Permission Denied when getting FileInputStream

    s k Newbie

      Hi All,

      I am getting a java.io.FileNotFoundException(Permission denied) exception when I am trying to open a FileInputStream to a file in my local directory that has permissions -rwxr--r--.

      Our application actually allows to copy a file from any location in the unix file system to our application's "vault" in the same unix file system.

      I am getting this error when trying to copy a file with the above permissions from my home directory to the vault location from GUI. But I am able to successfully copy the same file from the my home directory to the same vault location using a test case(run using TestNG which basically uses JUnit).

      Our application is deployed in JBoss and I am logging in as myself into our application.

      I have seen the server.policy file in /jboss-4.0.2/server/default/conf/ which grants AllPermissions:

      grant {
       // Allow everything for now
       permission java.security.AllPermission;

      But I am still wondering why I am getting the (Permission denied) exception when I access our application from GUI while I am trying to open a FileInputStream to this file which has "read" access to all the users (in the backend code); suprisingly I don't get this error when I run the backend code from the TestNG test case !!!

      I would really appreciate any help regarding what I am missing here. I am not even sure whether it is JBoss's login-config.xml or server.policy that I need to change to get read access to the file I am accessing.

      Please let me know. This is difficult to debug for me and I am totally frustrated now. I have been on this for the past 4 days, but could not resolve it. Looking for help.

      Our application uses, Spring 2.0, Hibernate 3.2 and AJAX backed by Oracle and deployed in JBoss 4.0.2.