Re: java.io.FileNotFoundException: Permission denied Exception

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 28 Aug 2002 12:18:53 -0700
Message-ID: <92eeeff0.0208281118.7077aac4_at_posting.google.com>


sivaprasad_sreenivasan_at_non.hp.com (siva) wrote in message news:<d1f7fb68.0208280551.56704c10_at_posting.google.com>...
> I get the above exception while I try to run a Java Stored procedure
> on Oracle DataBase.
> No exception is thrown when the application is "loaded" into the
> DataBase.The exception is thrown when the application is run.
> The exception is thrown when the program tries to fetch a particular
> file(a properties file). Infact I have set the read,write and even
> execute 'action' with java.io.FilePermission for this particular file
> in the DataBase.But still the following exception is thrown
>
> java.io.FileNotFoundException: Permission denied
> at java.io.FileInputStream.open(FileInputStream.java)
> at java.io.FileInputStream.<init>(FileInputStream.java)
>
> Could anybody help me on this please??
>
> Cheers
> Sivan

Login as SYS and run following,

SQL> execute dbms_java.grant_permission( '&USER_OR_ROLE_NAME',
                                         'SYS:java.io.FilePermission',
                                         '&YOUR_DIRECTORY',
                                         'read,write');
SQL> execute dbms_java.grant_permission( '&USER_OR_ROLE_NAME',
                                        
'SYS:java.lang.RuntimePermission',
                                         'readFileDescriptor',
                                          NULL );
SQL> execute dbms_java.grant_permission( '&USER_OR_ROLE_NAME',
                                        
'SYS:java.lang.RuntimePermission',
                                         'writeFileDescriptor',
                                          NULL );
SQL> execute dbms_java.grant_permission( '&USER_OR_ROLE_NAME',
                                        
'SYS:java.util.PropertyPermission',
                                         '&YOUR_DIRECTORY',
                                         'read,write');
SQL> commit;

Logoff and logon.

One suggestion. Create a role e.g. JAVA_USER and grant all these permissions to JAVA_USER. Then grant JAVA_USER to any user or role who may need access to this directory.

//Rauf Sarwar Received on Wed Aug 28 2002 - 21:18:53 CEST

Original text of this message