ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

RPGLE and JVM

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RPGLE and JVM

    Hi there. We have an application that includes an RPGLE program calling Java code. This is failing to run on one client's system (out of several hundred clients) due to JVM startup issues. I've checked their environment settings (e.g. JAVA_HOME, installed Java licensed programs and relevant IFS folders) and everything looks okay.

    I know that RPGLE will only start one JVM per job, and will reuse a previously opened JVM if it exists, which leads me to wonder whether this client has something else running earlier in the job that has started JVM, and then our program is stuck with attempting to use a JVM that may be corrupt or have been started with incompatible settings. Am I right in supposing that there are Java settings specified in the RPGLE code that could prevent one program from using the JVM started by another program?

    If I want to troubleshoot this further, is there any programmatic way of identifying whether JVM is already running and the runtime attributes, or is that all done behind the scenes?

    Thanks,
    Kevan

  • #2
    If the JVM was previously started with incompatible settings (e.g. CLASSPATH), then your Java code would fail. I typically check the joblog to see when the JVM was started and by what program. You can also use the WRKJVMJOB command to display the JVM settings for the job in question.

    Comment


    • #3
      Kevan, it's not that RPG has settings that would prevent one program from using the JVM started by another program. It's that Java itself will only allow one JVM per job, and things like the classpath are set when the JVM starts.

      There are examples in the ILE RPG Programmer's Guide that show how to do things like find out whether the JVM is already started. But you would not be able to do any recovery within your program to to correct the situation.

      In the example on this page, the code first tries to get the JNI Environment pointer. If that fails, then the JVM has not been started yet.

      Comment

      Working...
      X