Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-3698

Incompatibility between NetBeans 10.0+ and JaCoCo 0.8.3+

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.0, 11.0, 11.1, 11.2
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None

      Description

      Building a NetBeans module with Maven and using the jacoco-maven-plugin 0.8.3 or later (current version is 0.8.5, required for Java 13 compatibility) halts a Java 8 JVM during test execution with the maven-surefire-plugin.

      The attached project demonstrates this.

      $ mvn clean install -DnetbeansVersion=RELEASE100 -DjacocoVersion=0.8.3
      …
      [INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ bug ---
      [INFO] 
      [INFO] -------------------------------------------------------
      [INFO]  T E S T S
      [INFO] -------------------------------------------------------
      [WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file /home/sewe/NetBeansProjects/bug/target/surefire-reports/2020-01-15T09-22-15_152-jvmRun1.dumpstream
      [INFO] 
      [INFO] Results:
      [INFO] 
      [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
      [INFO] 
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  3.519 s
      [INFO] Finished at: 2020-01-15T09:22:15+01:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project bug: There are test failures.
      [ERROR] 
      [ERROR] Please refer to /home/sewe/NetBeansProjects/bug/target/surefire-reports for the individual test results.
      [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
      [ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
      …
      [ERROR] Error occurred in starting fork, check output in log
      [ERROR] Process Exit Code: 134
      …
      
      $ cat target/surefire-reports/*.dumpstream
      # Created at 2020-01-15T09:22:15.624
      Exception in thread "main" java.lang.reflect.InvocationTargetException
      
      # Created at 2020-01-15T09:22:15.626
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      
      # Created at 2020-01-15T09:22:15.627
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      
      # Created at 2020-01-15T09:22:15.627
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      
      # Created at 2020-01-15T09:22:15.627
      	at java.lang.reflect.Method.invoke(Method.java:498)
      
      # Created at 2020-01-15T09:22:15.627
      	at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386)
      
      # Created at 2020-01-15T09:22:15.627
      	at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401)
      
      # Created at 2020-01-15T09:22:15.627
      Caused by: java.lang.SecurityException: Prohibited package name: java.lang
      
      # Created at 2020-01-15T09:22:15.628
      	at java.lang.ClassLoader.preDefineClass(ClassLoader.java:662)
      
      # Created at 2020-01-15T09:22:15.628
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:761)
      
      # Created at 2020-01-15T09:22:15.628
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      
      # Created at 2020-01-15T09:22:15.628
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
      
      # Created at 2020-01-15T09:22:15.629
      	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
      
      # Created at 2020-01-15T09:22:15.629
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
      
      # Created at 2020-01-15T09:22:15.629
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
      
      # Created at 2020-01-15T09:22:15.629
      	at java.security.AccessController.doPrivileged(Native Method)
      
      # Created at 2020-01-15T09:22:15.630
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
      
      # Created at 2020-01-15T09:22:15.630
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      
      # Created at 2020-01-15T09:22:15.630
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
      
      # Created at 2020-01-15T09:22:15.630
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      
      # Created at 2020-01-15T09:22:15.630
      	at java.lang.Class.forName0(Native Method)
      
      # Created at 2020-01-15T09:22:15.631
      	at java.lang.Class.forName(Class.java:264)
      
      # Created at 2020-01-15T09:22:15.631
      	at org.jacoco.agent.rt.internal_1f1cc91.PreMain.redefineJavaBaseModule(PreMain.java:79)
      
      # Created at 2020-01-15T09:22:15.631
      	at org.jacoco.agent.rt.internal_1f1cc91.PreMain.createRuntime(PreMain.java:60)
      
      # Created at 2020-01-15T09:22:15.631
      	at org.jacoco.agent.rt.internal_1f1cc91.PreMain.premain(PreMain.java:51)
      
      # Created at 2020-01-15T09:22:15.631
      	... 6 more
      
      # Created at 2020-01-15T09:22:15.764
      Aborted (core dumped)
      
      # Created at 2020-01-15T09:22:15.626
      Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'FATAL ERROR in native method: processing of -javaagent failed'.
      

      You can toy with the two parameters -DnetbeansVersion and -DjacocoVersion and will see that the problems begin in both -DnetbeansVersion is RELEASE100 or newer and -DjacocoVersion is 0.8.3 or newer.

      Looking at the dependency tree (mvn dependency:tree) of the project the problem can be traced to the transitive dependency on {{org-netbeans-bootstrap, which contains its own implementation of java.lang.Module. Trying to instrument that causes the SecurityException during premain.

        Attachments

        1. bug.zip
          4 kB
          Andreas Sewe

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              asewe Andreas Sewe
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: