substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Consider all output lines of java -version when determining the version of GraalVM

Open vatbub opened this issue 3 years ago • 0 comments

I am facing an issue where my anti virus program injects a java agent into any java process (c.f. this question on StackOverflow). The result is that any executions of the java command emit the following output first:

[0.038s][warning][jni,resolve] Re-registering of platform native method: java.lang.PanwHooks.NativeMethodEntry(Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang
/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V from code in a different classloader

The output of java -version therefore looks like so:

[0.059s][warning][jni,resolve] Re-registering of platform native method: java.lang.PanwHooks.NativeMethodEntry(Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V from code in a different classloader
openjdk version "17.0.4" 2022-07-19
OpenJDK Runtime Environment GraalVM CE 22.2.0 (build 17.0.4+8-jvmci-22.2-b06)
OpenJDK 64-Bit Server VM GraalVM CE 22.2.0 (build 17.0.4+8-jvmci-22.2-b06, mixed mode, sharing)

The result is that Substrate fails to determine the version of the GraalVM as it gets tripped by the first line in output.

Expected Behavior

Substrate should ignore any lines it can't parse and determine the version of GraalVM correctly.

Current Behavior

The following IOException is thrown:

java.io.IOException: Couldn't determine GraalVM's Java version for [0.067s][warning][jni,resolve] Re-registering of platform native method: java.lang.PanwHooks.NativeMethodEntry(Ljava/lang/Object;ILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Obje
ct;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V from code in a different classloader
        at com.gluonhq.substrate.model.InternalProjectConfiguration.getGraalVMJavaVersion(InternalProjectConfiguration.java:662)
        at com.gluonhq.substrate.model.InternalProjectConfiguration.checkGraalVMJavaVersion(InternalProjectConfiguration.java:480)
        at com.gluonhq.substrate.SubstrateDispatcher.<init>(SubstrateDispatcher.java:382)
        at com.gluonhq.NativeBaseMojo.createSubstrateDispatcher(NativeBaseMojo.java:159)
        at com.gluonhq.NativePackageMojo.execute(NativePackageMojo.java:47)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
...

Steps to Reproduce

  1. Run mvn gluonfx-maven-plugin:package

Your Environment

The anti virus that my company is using is Cortex by Palo Alto Networks

Rest of my environment:

  • Windows 10
  • Java version under which Maven is executed: Temurin-17.0.4.1+1
  • GraalVM version as described above
  • gluonfx-maven-plugin version 1.0.15 If you need any help with testing, let me know.

vatbub avatar Oct 13 '22 17:10 vatbub