You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Andreas Sewe (Jira)" <ji...@apache.org> on 2020/01/15 08:54:00 UTC

[jira] [Commented] (NETBEANS-3698) Incompatibility between NetBeans 10.0+ and JaCoCo 0.8.3+

    [ https://issues.apache.org/jira/browse/NETBEANS-3698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17015733#comment-17015733 ] 

Andreas Sewe commented on NETBEANS-3698:
----------------------------------------

The problematic part seems to be this bit in JaCoCo (not assigning blame here, though): https://github.com/jacoco/jacoco/blob/v0.8.5/org.jacoco.agent.rt/src/org/jacoco/agent/rt/internal/PreMain.java#L61

JaCoCo checks whether it is running on Java 9 or later by attempting to load {{java.lang.Module}}. On a Java 8 JVM, this apparently caused the class to be loaded from {{org-netbeans-bootstrap}}. On a Java 11 JVM, on the other hand, everything runs fine: {{JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 mvn clean verify -DnetbeansVersion=RELEASE112 -DjacacoVersion=0.8.5}}.

This raises the question: Why does NetBeans ship its own (empty dummy) version of {{java.lang.Module}}?

> Incompatibility between NetBeans 10.0+ and JaCoCo 0.8.3+
> --------------------------------------------------------
>
>                 Key: NETBEANS-3698
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-3698
>             Project: NetBeans
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 10.0, 11.0, 11.1, 11.2
>            Reporter: Andreas Sewe
>            Priority: Major
>         Attachments: bug.zip
>
>
> 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.
> {noformat}
> $ 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'.
> {noformat}
> 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}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists