[ https://issues.apache.org/jira/browse/SUREFIRE-1882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17272127#comment-17272127 ]
Tibor Digana commented on SUREFIRE-1882: ---------------------------------------- [~kriegaex] This issue was found out after the release because i used JDK11+ however the compiler was set to java source/target version 1.8. I guess the users used Java 1.8. In the current development iteration we have imposed the limitation on the build only to Java 1.8 but the tests used another JVM and this way we were safe. We wanted to bypass the issue this way because we did not understand the root cause and workaround. {quote} >> BTW, are there or could someone add any static byte code verifiers in >> Surefire which could automatically detect and report this issue? {quote} I think we can do it in the build when we simply build the project with higher version of JDK than the integration tests. This means JDK 11 for the project and JDK 1.8 for the tests. > 3.0.0-M6-SNAPSHOT no longer working with Java 8 > ----------------------------------------------- > > Key: SUREFIRE-1882 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1882 > Project: Maven Surefire > Issue Type: Bug > Components: Maven Failsafe Plugin, Maven Surefire Plugin > Affects Versions: 3.0.0-M6 > Reporter: Alexander Kriegisch > Priority: Major > Attachments: 2021-01-26T13-22-12_972-jvmRun1.dump > > > When running my build on JDK 8, I see > {code} > [INFO] --- maven-surefire-plugin:3.0.0-M6-SNAPSHOT:test (reuse-jvm) @ > sarek-mock --- > [INFO] > [INFO] ------------------------------------------------------- > [INFO] T E S T S > [INFO] ------------------------------------------------------- > [INFO] > [INFO] Results: > [INFO] > [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 > [INFO] > [WARNING] Could not delete temp directory > C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157 because File > C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157\surefirebooter4446112705128419789.jar > unable to be deleted. > [INFO] > ------------------------------------------------------------------------ > [INFO] Reactor Summary for sarek-parent 1.0-SNAPSHOT: > [INFO] > [INFO] (...) > [INFO] sarek-mock ......................................... FAILURE [ 1.541 > s] > [INFO] (...) > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 15.095 s > [INFO] Finished at: 2021-01-26T13:22:20+07:00 > [INFO] > ------------------------------------------------------------------------ > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M6-SNAPSHOT:test > (reuse-jvm) on project sarek-mock: There are test failures. > [ERROR] > [ERROR] Please refer to > C:\Users\alexa\Documents\java-src\Sarek\sarek-mock\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 cmd.exe /X /C ""C:\Program > Files\Java\jdk1.8.0_211\jre\bin\java" -jar > C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157\surefirebooter4446112705128419789.jar > C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157 > 2021-01-26T13-22-12_972-jvmRun1 surefire4902538894981773413tmp > surefire_05054187083706494231tmp" > [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The > forked VM terminated without properly saying goodbye. VM crash or System.exit > called? > [ERROR] Command was cmd.exe /X /C ""C:\Program > Files\Java\jdk1.8.0_211\jre\bin\java" -jar > C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157\surefirebooter4446112705128419789.jar > C:\Users\alexa\AppData\Local\Temp\surefire9150168311367699157 > 2021-01-26T13-22-12_972-jvmRun1 surefire4902538894981773413tmp > surefire_05054187083706494231tmp" > [ERROR] at > org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:751) > [ERROR] at > org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:306) > [ERROR] at > org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:266) > [ERROR] at > org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1320) > [ERROR] (...) > {code} > See also the dump file attached to this ticket. > When running the build e.g. with Java 11 or Java 14, the same error does not > occur. I tested with the current master, commit > [f14fa54b|https://github.com/apache/maven-surefire/commit/f14fa54b9eba073c8c896a829fac1c2037b34222]. > The root cause seems to be this part of the dump file: > {code} > java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer; > at > org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleWritableChannel.write(AbstractNoninterruptibleWritableChannel.java:67) > at > org.apache.maven.surefire.api.util.internal.AbstractNoninterruptibleWritableChannel.write(AbstractNoninterruptibleWritableChannel.java:44) > at > org.apache.maven.surefire.api.stream.AbstractStreamEncoder.write(AbstractStreamEncoder.java:77) > at > org.apache.maven.surefire.booter.spi.EventChannelEncoder.write(EventChannelEncoder.java:333) > at > org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeOpcode(EventChannelEncoder.java:324) > at > org.apache.maven.surefire.booter.spi.EventChannelEncoder.bye(EventChannelEncoder.java:274) > at > org.apache.maven.surefire.booter.ForkedBooter.acknowledgedExit(ForkedBooter.java:419) > at > org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:194) > at > org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:570) > at > org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:556) > {code} > {{ByteBuffer.flip()}} simply does not exist yet in Java 8. The [read-me > file|https://github.com/apache/maven-surefire/blob/master/README.md] says: > ??Build the Surefire project using Maven 3.1.0+ and JDK 1.8+.?? > OTOH, the corresponding [commit > 5e3348cd|https://github.com/apache/maven-surefire/commit/5e3348cdf29d1d49ca615a893b9174563f62815c#diff-0dc38587795788db7bf5bc5366d065899b92d6680be60003ecd6af0fad3c8156] > by [~tibordigana] is 2 years old already, calling a Java 9+ method > {{flip()}}: -- This message was sent by Atlassian Jira (v8.3.4#803005)