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!

Running Java 11 stored procedures in Oracle 19c

User_PBLIBSep 21 2021

I am a developer without an Oracle support license exploring the publicly downloadable Oracle 19c database. This installation comes with an embedded Java version 8. I would like to test Java 11 stored procedures (User Defined Functions). To do this, I would need to upgrade the embedded Java 8 to Java 11. Currently I am getting the message (Unsupported major.minor version 55.0) when I try to CALL my Java 11 function from within the SQL> prompt like this:

SQL> CALL udfversion() INTO :myString;
CALL udfversion() INTO :myString
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java/lang/UnsupportedClassVersionError : UDFtest (Unsupported major.minor version 55.0)

I see that there is a directory $ORACLE_HOME/javavm/jdk/jdk8 that purports to be the source of the embedded Java 8 I now have. For reference, this is what the jdk8 directory looks like:

$ tree /opt/oracle/product/19c/dbhome_1/javavm/jdk/jdk8
/opt/oracle/product/19c/dbhome_1/javavm/jdk/jdk8
├── admin
│ ├── cbp.jar
│ ├── classes.bin
│ ├── lfclasses.bin
│ └── libjtcjt.so
├── layout.txt
├── lib
│ ├── jce.jar
│ ├── libjavavm19.a
│ ├── security
│ │ ├── cacerts
│ │ ├── java.security
│ │ └── README.txt
│ └── sunjce_provider.jar
└── s_layout.txt

In order for me to upgrade this to JDK 11, I would presume that I would need to download and install a jdk11 version of this directory. I see there is a perl script $ORACLE_HOME/javavm/install/update_javavm_binaries.pl that is designed to perform this upgrade once I have the jdk11 directory in place. Here is what happens when I use this perl script to upgrade to Java 11:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/javavm/install/update_javavm_binaries.pl -install 11
Could not open /opt/oracle/product/19c/dbhome_1/javavm/jdk/jdk11/layout.txt
Could not open /opt/oracle/product/19c/dbhome_1/javavm/jdk/jdk11/s_layout.txt
Could not open /opt/oracle/product/19c/dbhome_1/javavm/jdk/jdk11/admin

Obviously, the jdk11 directory is missing. I've tried using the standard jdk 11 package but it is missing libjtcjt.so, libjavavm19.a, cbp.jar etc. This leads me to believe that $ORACLE_HOME/javavm/jdk/jdk11 is a special set of files needed for Oracle 19c.

My question is where would I be able to download these jdk11 files assuming that they are publicly available? Has anyone tried to upgrade the embedded Java 8 to at least Java 11 or higher so that stored procedures compiled for Java 11 can run?

Comments

alwu-Oracle
What is your DB version and what version of Jena Adaptor are you using?

Thanks,

Zhe Wu
Ram Krishna
The oracle database is v11.1.0.7 and we are using the new Jena adaptor (rel 3) that we got from our metalink site.

ram
alwu-Oracle
Hi,

It seems that the new version of Jena Adaptor is doing the right job to convert the whole SPARQL into a single SEM_MATCH based query. Now the problem is that 11.1.0.7 database has this known server side bug (table function related) when the query is too big. You did not see this problem with Jena Adaptor v2 because ARQ breaks the query into many small pieces.

To fix this problem, there are a few choices:

1) upgrade to database 11.2, or
2) shorten your query, or
3) file a tar with Oracle support.

We are working on an optimization in Jena Adaptor to convert a SPARQL (with just a base BGP and a number of parallel OPTIONAL clauses) into a plain SQL. This may solve your problem even if you continue use 11.1.0.7.

Cheers,

Zhe Wu
Ram Krishna
Thanks Zhe- that is helpful. We will use one of the workarounds before we switch to 11.2.

ram
1 - 4

Post Details

Added on Sep 21 2021
0 comments
1,719 views