User f05f6b8c05
19-12-2012 17:10:08
Hi,
I am not sure if this is the correct chemaxon forum for this question.
Our db environment is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0.
I'm trying to make a Java Stored Procedure that makes use of the API. The below example is simplified relative to what we ultimately need, but it reproduces the problem.
Starting materials:
AKChemTest.java -- this contains the Java Stored Procedure code (file is attached)
mb5413/ -- local directory that contains all MarvinBeans*jar files taken from marvinbeans-5.4.1.3.zip (the highest version compatible with Java 1.5 (used internally by Oracle 11g))
Creation of Java Stored Procedure:
/usr/1r43_java/bin/javac -cp mb5413/*:.:/usr/1r43_tomcat/1r43reg/WEB-INF/lib/ojdbc6.jar -target 1.5 -source 1.5 akpkg2/AKChemTest.java
/usr/1r43_java/bin/jar -cvf akpck2.jar akpkg2/*class
/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/loadjava -user registry1r43/XXXXX@reg1r43p -resolve -grant JCC_BASIC_ROLE -v -genmissing akpck2.jar mb5413/*jar
sqlplus registry1r43/XXXXX@reg1r43p
CREATE OR REPLACE FUNCTION ak_getfullstructuretest (lots_id IN NUMBER)
RETURN CLOB AS LANGUAGE JAVA
NAME 'akpkg2.AKChemTest.GetFullStructureTest (int) return oracle.sql.CLOB';
.
/
The problem:
If I start calling the function a large number of times in a row, it is stable for a while (~2600 structures), but then I start to get these errors:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException (DBD ERROR: OCIStmtFetch) [for Statement "select ak_getfullstructuretest(1629206) from dual"]
(I'm calling the stored procedure from a perl script)
Once I start getting these errors, then I cannot successfully call the function on parameter id's that were previously successful, even directly through sqlplus:
select ak_getfullstructuretest(1620700) from dual; (<-- previously 1620700 gave a successful response)
ERROR:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.NullPointerException
However, if I dropjava/loadjava and then remake the function, then I can once again have "select ak_getfullstructuretest(1620700) from dual;" work OK:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dropjava -user registry1r43/XXXXX@reg1r43p akpck2.jar mb5413/*jar
/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/loadjava -user registry1r43/XXXXX@reg1r43p -resolve -grant JCC_BASIC_ROLE -v -genmissing akpck2.jar mb5413/*jar
sqlplus registry1r43/XXXXX@reg1r43p
CREATE OR REPLACE FUNCTION ak_getfullstructuretest (lots_id IN NUMBER)
RETURN CLOB AS LANGUAGE JAVA
NAME 'akpkg2.AKChemTest.GetFullStructureTest (int) return oracle.sql.CLOB';
.
/
SQL> select ak_getfullstructuretest(1620700) from dual;
AK_GETFULLSTRUCTURETEST(1620700)
--------------------------------------------------------------------------------
Mrv0541 12191211202D
35 39 0 0 0 0 999 V2000
-0
Can you provide any guidance on how to avoid these NullPointerExceptions? Please let me know if any other information would be useful.
Thanks very much in advance.
Best,
Andrew