Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1820

Using SurefireForkNodeFactory with JDK8 results in NoSuchMethodError

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-M5
    • Fix Version/s: 3.0.0-M6
    • Component/s: process forking
    • Labels:
      None

      Description

      Attempting to use TCP channels for communication with JDK 1.8 results in the following splat:

      xception in thread "commands-fork-1" java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
              at org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleWritableChannel.write(AbstractNoninterruptibleWritableChannel.java:76)
              at org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleWritableChannel.write(AbstractNoninterruptibleWritableChannel.java:44)
              at org.apache.maven.plugin.surefire.extensions.StreamFeeder.run(StreamFeeder.java:92)
      Exception in thread "fork-1-event-thread" java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
              at org.apache.maven.plugin.surefire.extensions.EventConsumerThread.decode(EventConsumerThread.java:140)
              at org.apache.maven.plugin.surefire.extensions.EventConsumerThread.run(EventConsumerThread.java:113)
      Exception in thread "fork-1-err-thread" java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
              at org.apache.maven.surefire.api.util.internal.Channels$3.readImpl(Channels.java:217)
              at org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleReadableChannel.read(AbstractNoninterruptibleReadableChannel.java:54)
              at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:274)
              at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
              at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
              at java.io.Reader.read(Reader.java:100)
              at java.util.Scanner.readInput(Scanner.java:804)
              at java.util.Scanner.findWithinHorizon(Scanner.java:1685)
              at java.util.Scanner.hasNextLine(Scanner.java:1500)
              at org.apache.maven.surefire.extensions.util.LineConsumerThread.run(LineConsumerThread.java:67)
      

      at least in the following configuration:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default) on project pt-triemap: There are test failures.
      [ERROR] 
      [ERROR] Please refer to /home/nite/pt/triemap/pt-triemap/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] Command was /bin/sh -c cd /home/nite/pt/triemap/pt-triemap && /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-1.fc32.x86_64/jre/bin/java -jar /home/nite/pt/triemap/pt-triemap/target/surefire/surefirebooter5389144270021152085.jar /home/nite/pt/triemap/pt-triemap/target/surefire 2020-07-14T09-05-53_813-jvmRun1 surefire4432899852251024839tmp surefire_06735691049687446297tmp

      Based on the discussion here: https://github.com/eclipse/jetty.project/issues/3244 , it would seem the cause is that surefire release was compiled with JDK9+ without setting --release to 8-or-lower.

        Attachments

          Activity

            People

            • Assignee:
              tibordigana Tibor Digana
              Reporter:
              nite Robert Varga
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: