0

We have a Spring Boot application which is built as an executable jar and runs fine using both the Oracle and OpenJDK JREs (using 1.8 versions).

Attempting to run it using the IBM 1.8 JRE however results in the following error at the command line.

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

This occurs if we execute the jar (using ./application.jar) or using java -jar application.jar

This led us to change the packaging to not make the jar executable and this allows us to start the application using java -jar application.jar. So it appears the IBM JRE doesn't like the launch script.

The problem is we don't want to have two packaging methods for different deployment environments, if possible.

Does anyone have any experience of why the IBM JRE doesn't like the script on the front of the jar file and whether there are any command line options to disable whatever checking its doing?

tonyob
  • 101
  • 1
  • 4

1 Answers1

0

From your post it is unclear if you have problem with 1) running jar from Linux like chmod a+x application.jar and executing Or 2) running via /opt/IBM/java/jre/bin/java -jar application.jar

For option 1) it is not a good idea as you do not explicitly choose jvm binary and rely on OS to choose one for you. Read about binfmt_misc mechanism:

https://en.m.wikipedia.org/wiki/Binfmt_misc

For option 2)-it might be class loading problem, please add /opt/IBM/java/jre/bin/java -verbose:class -jar application.jar

and consult documentation here: https://www.ibm.com/developerworks/library/j-dclp1/index.html

Marcin P
  • 430
  • 1
  • 5
  • 11
  • Hi, the problem is with either approach. The issue appears to be that the IBM JRE doesn't like the embedded launch script that Spring Boot adds when creating the executable jar. If we remove the script, its fine. One interesting note is that we've had some success running with the executable jar when additional command line parameters are used (can be anything after (e.g. `java -jar application.jar -randomextraparameter`) – tonyob Jul 06 '17 at 08:18
  • So you probably hit the limits of either IBM Java JRE (J9) or the Spring Boot project. It would be best if you seek help on https://spring.io/questions – Marcin P Jul 10 '17 at 12:30