QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Scott Klement's open source interface to using JDBC database drivers from RPG. http://www.scottklement.com/jdbc/
Post Reply
jjacobs207
Posts: 15
Joined: Mon Aug 07, 2023 5:59 pm

QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Post by jjacobs207 »

I apologize if this is a newbie question. I've programmed Java on Windows and IBM Unix, but this is my first attempt on the iSeries.

I would appreciate any assistance with the following error.

Situation: iSeries v7r2m0 RPGLE program using JDBCR4, for now just trying to access local DB2 database table (ultimately, will be accessing remote SQL Server database table). I believe Java is set up correctly on iSeries, as we use it for product CommercialWare and IBM MQ Series.

JVMJ9VM007E Command-line option unrecognised: -Djava.compiler=NONE
Unable to create Java Virtual Machine.

QRNXUTIL _QRNI_getJNIEnv MCH3601 Pointer not set for location referenced

CLASSPATH='/java/jdbc/jt400.jar:/CWJava/prod/CWEncryption.jar:/QIBM/ProdData/mqm/java/lib'

RPGLE program having trouble starting JVM as a result of first line in program:
prop = JDBC_Properties();

Service program JDBCR4, subprocedure JDBC_Properties, line causing error:
jdbc_get_jni_env();

Service program JDBCR4, subprocudure jdbc_get_jni_env, line causing error:
wwEnv = start_jvm();

Service program JDBCR4, subprocedure start_jvm, line causing error:
wwStr = s('Temp String');

Job log:
First error: MCH3601 Pointer not set for location referenced.
Second error: Java exception received when calling Java method.
RPG procedure START_JVM in program JDBCR4/JDBCR4 received Java exception "**UNKNOWN ERROR**" when calling method "<init>" with signature "([B)V" in class "java.lang.String".

Screenshots are attached.

Thanks!
Attachments
QRNXUTIL _QRNI_getJNIEnv MCH3601.png
QRNXUTIL _QRNI_getJNIEnv MCH3601.png (11.78 KiB) Viewed 805 times
Pointer not set for location referenced.png
Pointer not set for location referenced.png (7.5 KiB) Viewed 805 times
Unable to create JVM.png
Unable to create JVM.png (5.17 KiB) Viewed 805 times
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Post by Scott Klement »

As far as I can tell from your message, the error is "JVMJ9VM007E Command-line option unrecognised: -Djava.compiler=NONE
Unable to create Java Virtual Machine"

JDBCR4 doesn't set that option. You'll need to figure out what is setting it, and change it so that it's not being set.
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Post by Scott Klement »

Could you have it set in a QIBM_RPG_JAVA_PROPERTIES environment variable, maybe?
jjacobs207
Posts: 15
Joined: Mon Aug 07, 2023 5:59 pm

Re: QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Post by jjacobs207 »

Scott,

Yes, that command-line option is coming from our QIBM_RPG_JAVA_PROPERTIES environment variable.
I thought I saw on the internet that unrecognized command-line options would be ignored, so I wasn't concerned about the message.
Here's our ENVVAR:
'-Djava.version=1.8; -Djava.compiler=NONE; -Djava.awt.headless=true; -Dos400.awt.native=true;'

Out of all of these, only java.version is recognized. Once I got rid of the rest, the JVM started successfully. Problem solved. :oops:

Thanks always and again for your help!

P.S. I also saw a comment on the internet about having the job's CCSID set to 65535 causing issues with Java, possibly when working with remote non-iSeries systems/DBMSes. (Ultimately, I'm going to be accessing SQL Server on Windows Server.) Our system is set with CCSID of 65535, but on the job level the default CCSID is 37:
Coded character set identifier . . . . . . . . . : 65535
Default coded character set identifier . . . . . : 37

Do you foresee me running into issues because of this?
Scott Klement
Site Admin
Posts: 658
Joined: Sun Jul 04, 2021 5:12 am

Re: QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Post by Scott Klement »

I've mostly run into problems with 65535 when working with "regular" embedded SQL rather than JDBC. (And yes, having QCCSID set to 65535 and the calculated 'default' CCSID set to 37 is the exact circumstance under which you will run into them.)

Note that this doesn't have to be fixed system-wide. You can change it for only the duration of the current job by doing CHGJOB CCSID(37)

As to whether you'll run into the problems, I don't know... If you do, you can always change it with CHGJOB.

I hate that we're still having this conversation in 2024, though.
jjacobs207
Posts: 15
Joined: Mon Aug 07, 2023 5:59 pm

Re: QRNXUTIL _QRNI_getJNIEnv Pointer not set for location referenced

Post by jjacobs207 »

I understand. I might as well change the job's CCSID to 37 to avoid any potential problems.

Thanks, Scott, for your prompt reply.
Post Reply