× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Justin,

You can only load the JVM once per job. So when the JVM ends, you won't be able to use it again.

I know the error mentions System.exit() (which kills the JVM) but in my experience, this usually happens because of a coding error that causes Java to terminate itself. (For example, if you pass a *NULL object, Java will terminate itself, and subsequent messages will refer to System.exit)

You should examine what's happening during the first call, see if something is happening that is causing an error, and try to fix that code.

I guess it's possible that the 3rd party app is calling System.exit() directly -- but that would surprise me greatly, as I've not seen a Java app do that, and I've interfaced with quite a few Java apps! If the app really is calling System.exit(), then RUNJVA might be your best bet. Since the JVM is ended with each call, you won't be able to improve upon performance. But, imho, this is unlikely to be the case.

If performance is important, you might find it performs better if Java and this application are loaded into a separate job, such as a Java application server, and then connect and communicate with that job through sockets, pipes, data queues, or something like that. Obviously this adds a new level of complexity, but will give you the best performance.

Calling Java from RPG (which uses JNI) may be better performance than calling RUNJVA repeatedly, though.

-SK


On 11/27/2015 10:16 AM, Justin Taylor wrote:
I have an RPGLE program that calls a 3rd party Java app. Right now it does a handful of RUNJVA using QCMDEXC. I'm trying to call the Java directly from RPGLE because I think I'll get better performance on repeat calls. Running interactively, the first Java call seems to work, but I get this MCH74A5 error:
Message . . . . : The Java Virtual Machine has ended.
Cause . . . . . : Java Virtual Machine 1 has ended because of reason 1. The
reason codes are defined as follows:
01- A Java program called the java.lang.System.exit method with a zero
status code.

From what I can find, a 0 code means success, so I'm not sure why it's killing my JVM.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.