Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Loaded Apache FOP getting "java.security.AccessControlException"

Roman_OCPSep 4 2014 — edited Oct 2 2014

I've loaded Apache FOP into the database.

-------------------- database version------------------------

SQL*Plus: Release 11.2.0.1.0 Production on Thu Sep 4 11:36:24 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

----------------------------------------------------------------------

CREATE AND RESOLVE JAVA SOURCE NAMED "OracleFop" AS

...

  // Step 1: Construct a FopFactory

        // (reuse if you plan to render multiple documents!)

  //------

   String configFileName = "/opt/project/resources/userConfig.xml";

   DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();

   Configuration cfg = cfgBuilder.buildFromFile(new File(configFileName));

   FopFactory fopFactory = FopFactory.newInstance();

   fopFactory.setUserConfig(cfg);

...

Java created.

but getting error whlie call it from the PL/SQL or Stroed procedure.

first time getting following error and grant the permission by dbms_java.grant_permission( 'DB_DEV', 'SYS:java.io.FilePermission', '/.fop', 'write' );

Error report -
ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /.fop write) has not been granted to DB_DEV. The PL/SQL to grant this is dbms_java.grant_permission( 'DB_DEV', 'SYS:java.io.FilePermission', '/.fop', 'write' )
ORA-06512: at "DB_DEV.PKG$PDF", line 135
ORA-06512: at line 2
29532. 00000 -  "Java call terminated by uncaught Java exception: %s"
*Cause:    A Java exception or error was signaled and could not be
           resolved by the Java code.
*Action:   Modify Java code, if this behavior is not intended.

now getting the following error! but why FOP want to write file into Disk?
Error report -
ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.io.FilePermission /tmp/.fop write) has not been granted to DB_DEV. The PL/SQL to grant this is dbms_java.grant_permission( 'DB_DEV', 'SYS:java.io.FilePermission', '/tmp/.fop', 'write' )
ORA-06512: at "DB_DEV.PKG$PDF", line 135
ORA-06512: at line 2
29532. 00000 -  "Java call terminated by uncaught Java exception: %s"
*Cause:    A Java exception or error was signaled and could not be
           resolved by the Java code.
*Action:   Modify Java code, if this behavior is not intended.

without redmarked code FOP can create PDF successfully. but I cann't use custom fonts. userConfig.xml file contain the font info.

CREATE AND RESOLVE JAVA SOURCE NAMED "OracleFop" AS

...

  // Step 1: Construct a FopFactory

        // (reuse if you plan to render multiple documents!)

  //------

   String configFileName = "/opt/project/resources/userConfig.xml";

   DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();

   Configuration cfg = cfgBuilder.buildFromFile(new File(configFileName));

   FopFactory fopFactory = FopFactory.newInstance();

  fopFactory.setUserConfig(cfg);

...

could you please point me out where is the wrong? why FOP want to write file into Disk? How can I use config from code for the FOP?

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 30 2014
Added on Sep 4 2014
1 comment
1,543 views