问题
When I call a JAVA class from PL/SQL I get the below error
ORA-29532 Java call terminated by uncaught java exception
I already referred a metalink note -Doc : 1420943.1
this asks to check the value (show parameters shared_servers
) and set to Zero if its not zero.
but the value is already 0.
pls help me to identify ,what is causing the issue.
-----------------------More Information -----------------------------------
We use loadjava -user apps/password - force -verbose -resolve java.class
to load the java class into the Oracle DB.
Database version 12c.
PL/SQL:
l_retCode := initialize(para_1 => l_para1,
Para_2 => l_para2,
para_3 => l_para3);
The initialize function is defined as below
function initialize(para_1 VARCHAR2, para_2 VARCHAR2, para_3 VARCHAR2)
return NUMBER as LANGUAGE JAVA NAME
'com.snlp.XXWClass.initialize(java.lang.string,java.lang.string,java.lang.string) return int'
Java code:
public static int initialize(s String, s1 String , s2 String){
// logic goes here
}
回答1:
1) In DB set serveroutput on
and exec dbms_java.set_output(10000000);
It allows to see java stack trace in db.
2) Publishing java class in wrong. Character size is significant. Change java.lang.string. to java.lang.String.
回答2:
Got the FIX from
http://www.oracle.com/technetwork/database/enterprise-edition/calling-shell-commands-from-plsql-1-1-129519.pdf
We need to give GRANTS like after logging as APPS(Pls see the link for more clear information- could not copy paste those commands so , i typed - there can be some typos in the below commands) the below commands fixed many issues in our JAVA call from Oracle
dbms_java.grant_permission( '<user_name>', 'SYS:java.util.PropertyPermission', '<property_name>', 'write' );
dbms_java.grant_permission( '<user_name>', 'SYS:java.util.RuntimePermission', 'writeFileDescriptor', '' );
dbms_java.grant_permission( '<user_name>', 'SYS:java.util.RuntimePermission', 'readFileDescriptor', '' );
exec DBMS_JAVA.Grant_Permission( '<user_name>', 'SYS:java.io.FilePermission','<<ALL FILES>>','read,write,execute,delete');
来源:https://stackoverflow.com/questions/44134160/error-while-calling-java-from-pl-sql