Thursday, February 02, 2012

dbms_java.grant_permission - java.lang.RuntimePermission setIO

Java runtime execution permission needs to be granted to a application user that using  java access control. DBA_JAVA_POLICY is the DBA view that shows us which users has what kind of permissions. 
A typical application error which is self explanatory:
Result is: the Permission (java.lang.RuntimePermission setIO) has not been granted to DB_USER. The PL/SQL to grant this is dbms_java.grant_permission( 'DB_USER', 'SYS:java.lang.RuntimePermission', 'setIO', '' ) at
               at java.lang.SecurityManager.checkPermission(
               at oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(
               at java.lang.System.checkIO(
               at java.lang.System.setOut(
               at com.testing.duplicate.AutoQuoteDuplicator.updateDuplicate(
               at com.testing.duplicate.AutoQuoteDuplicator.processDuplicateRequest(

Here is how we give permission:

execute dbms_java.grant_permission( DB_USER, 'SYS:java.lang.RuntimePermission', 'setIO', '' )

No comments: