Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-16365

Cannot run tests on Java 11 with coverage analysis

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.0-rc1, 4.0
    • Build
    • None

    Description

      When running tests with coverage analysis on Java 11, we get the problem as follows:

      [junit-timeout] FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
      [junit-timeout] Exception in thread "main" java.lang.reflect.InvocationTargetException
      [junit-timeout] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [junit-timeout] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      [junit-timeout] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [junit-timeout] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      [junit-timeout] 	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
      [junit-timeout] 	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
      [junit-timeout] Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
      [junit-timeout] 	at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
      [junit-timeout] 	at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
      [junit-timeout] 	at org.jacoco.agent.rt.internal_b0d6a23.PreMain.createRuntime(PreMain.java:55)
      [junit-timeout] 	at org.jacoco.agent.rt.internal_b0d6a23.PreMain.premain(PreMain.java:47)
      [junit-timeout] 	... 6 more
      [junit-timeout] Caused by: java.lang.NoSuchFieldException: $jacocoAccess
      [junit-timeout] 	at java.base/java.lang.Class.getField(Class.java:1999)
      [junit-timeout] 	at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
      [junit-timeout] 	... 9 more
      [junit-timeout] *** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
      

      It is caused by too old Jacoco which does seem to work well with Java 11. Upgrading Jacoco to the newest version 0.8.6 fixes the problem

      Attachments

        1. Screenshot 2020-12-24 at 14.23.13.png
          240 kB
          Michael Semb Wever
        2. Screenshot 2020-12-24 at 14.23.57.png
          367 kB
          Michael Semb Wever

        Issue Links

          Activity

            People

              jlewandowski Jacek Lewandowski
              jlewandowski Jacek Lewandowski
              Jacek Lewandowski
              Michael Semb Wever
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m