Oracle DB loadjava error (ORA-29509): incorrectly formed Java binary class definition

170 Views Asked by At

I'm trying to import an external library (log4j-api version 2.21.0) to the database but I get the following error:

CALL dbms_java.loadjava('-resolve -force -debug -fileout /home/usr/out.txt -verbose /home/usr/log4j-api-2.21.0.jar')
Error report -
ORA-29532: Java call terminated by uncaught Java exception: oracle.aurora.rdbms.MalformedDefinitionException: In ClassHandle.create in schema USRSCHEMA

ORA-29509: incorrectly formed Java binary class definition
ORA-06512: at "SYS.DBMS_JAVA", line 587
ORA-06512: at line 1
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.

with usr and USRSCHEMA being placeholders. I am using Oracle Database 19c and DBMS Java JDK version 1.8.0_201. The loadjava command is:

CALL dbms_java.loadjava('-resolve -force -debug -fileout /home/usr/out.txt -verbose /home/usr/log4j-api-2.21.0.jar')

Stack trace does not provide additional details nor does out.txt and USER_ERRORS table. Obviously, being an apache commons library, it should have no issues with compiling and compatibility. Namely, the major version is 52 and the library worked when I tried it out seperately in a locally compiled project. I downloaded the latest version of the jar from the jar-download website and it has no dependencies. To verify, I also downloaded other apache libraries and even gson, which were loaded into the database without issue. Their major versions varied from 49-52 so this isn't the problem I believe.

However, if I tried an earlier version of log4j-api, it gave me a different error related to resolving. Interestingly, the newest version that gave me this different error is log-4j-api version 2.9.1, which released a few days before Java 9. The earliest version of log-4j-api (version 2.0) loads into the database without problem.

What might be the issue?

Thanks.

0

There are 0 best solutions below