Reputation: 1382
I'm launching the test suite of an eclipse plugin project with org.eclipse.tycho:tycho-surefire-plugin:4.0.7:test
.
The process crashes before being able to run any test.
Error on Windows:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:4.0.7:test (default-test) on project org.scala-ide.sdt.core.tests: An unexpected error occurred while launching the test runtime (process returned error code 1 (HRESULT Code 0x1, check for example https://www.hresult.info/ for further details)). Command-line used to launch the sub-process was C:\Users\nicol\Downloads\jdk-17.0.4_windows-x64_bin\jdk-17.0.4\bin\java.exe -Dosgi.noShutdown=false -Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 -Xmx2048m -Dsdtcore.headless -Dsdtcore.notimeouts -DretryFlakyTests=true -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dosgi.classloader.lock=classname -Dosgi.clean=true -Daj.weaving.verbose=true -Dorg.aspectj.osgi.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true -jar C:\Users\nicol\.m2\repository\p2\osgi\bundle\org.eclipse.equinox.launcher\1.6.700.v20240213-1244\org.eclipse.equinox.launcher-1.6.700.v20240213-1244.jar -debug -consolelog -data C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work\data -install C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work -configuration C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work\configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\surefire.properties in working directory C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests -> [Help 1]
Same error on linux:
Error: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:4.0.7:test (default-test) on project org.scala-ide.sdt.core.tests: An unexpected error occurred while launching the test runtime (process returned error code 1). Command-line used to launch the sub-process was /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.10-7/x64/bin/java -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 -Xmx2048m -Dsdtcore.headless -Dsdtcore.notimeouts -DretryFlakyTests=true -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dosgi.classloader.lock=classname -Dosgi.clean=true -Daj.weaving.verbose=true -Dorg.aspectj.osgi.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true -jar /home/runner/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.6.700.v20240213-1244/org.eclipse.equinox.launcher-1.6.700.v20240213-1244.jar -data /home/runner/work/scala-ide/scala-ide/org.scala-ide.sdt.core.tests/target/work/data -install /home/runner/work/scala-ide/scala-ide/org.scala-ide.sdt.core.tests/target/work -configuration /home/runner/work/scala-ide/scala-ide/org.scala-ide.sdt.core.tests/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/runner/work/scala-ide/scala-ide/org.scala-ide.sdt.core.tests/target/surefire.properties in working directory /home/runner/work/scala-ide/scala-ide/org.scala-ide.sdt.core.tests -> [Help 1]
I reduced the pom to a smaller one to remove the sections that have nothing to do with test execution:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.scala-ide</groupId>
<artifactId>org.scala-ide.sdt.build</artifactId>
<version>4.7.1-SNAPSHOT</version>
<relativePath>../org.scala-ide.sdt.build/pom.xml</relativePath>
</parent>
<artifactId>org.scala-ide.sdt.core.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<testSuite>${project.artifactId}</testSuite>
<testClass>org.scalaide.TestsSuite</testClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>initialize</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
After a google search, I found this issue linked by this one on Github and tried to add <useJDK>BREE</useJDK>
, which didn't help.
Also, it appeared that I might need a toolchain configuration, so I created this ~/.m2/toolchains.xml
:
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<id>JavaSE-17</id>
<version>17</version>
</provides>
<configuration>
<jdkHome>C:\Users\nicol\Downloads\jdk-17.0.4_windows-x64_bin\jdk-17.0.4</jdkHome>
</configuration>
</toolchain>
</toolchains>
But I'm still having the issue. What did I miss ?
With stack trace details:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:4.0.7:test (default-test) on project org.scala-ide.sdt.core.tests: An unexpected error occurred while launching the test runtime (process returned error code 1 (HRESULT Code 0x1, check for example https://www.hresult.info/ for further details)). Command-line used to launch the sub-process was C:\Users\nicol\Downloads\jdk-17.0.4_windows-x64_bin\jdk-17.0.4\bin\java.exe -Dosgi.noShutdown=false -Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 -Xmx2048m -Dsdtcore.headless -Dsdtcore.notimeouts -DretryFlakyTests=true -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dosgi.classloader.lock=classname -Dosgi.clean=true -Daj.weaving.verbose=true -Dorg.aspectj.osgi.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true -jar C:\Users\nicol\.m2\repository\p2\osgi\bundle\org.eclipse.equinox.launcher\1.6.700.v20240213-1244\org.eclipse.equinox.launcher-1.6.700.v20240213-1244.jar -debug -consolelog -data C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work\data -install C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work -configuration C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work\configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\surefire.properties in working directory C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:52)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:161)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:73)
Caused by: org.apache.maven.plugin.MojoFailureException: An unexpected error occurred while launching the test runtime (process returned error code 1 (HRESULT Code 0x1, check for example https://www.hresult.info/ for further details)). Command-line used to launch the sub-process was C:\Users\nicol\Downloads\jdk-17.0.4_windows-x64_bin\jdk-17.0.4\bin\java.exe -Dosgi.noShutdown=false -Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 -Xmx2048m -Dsdtcore.headless -Dsdtcore.notimeouts -DretryFlakyTests=true -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dosgi.classloader.lock=classname -Dosgi.clean=true -Daj.weaving.verbose=true -Dorg.aspectj.osgi.verbose=true -Dorg.aspectj.weaver.showWeaveInfo=true -jar C:\Users\nicol\.m2\repository\p2\osgi\bundle\org.eclipse.equinox.launcher\1.6.700.v20240213-1244\org.eclipse.equinox.launcher-1.6.700.v20240213-1244.jar -debug -consolelog -data C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work\data -install C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work -configuration C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\work\configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests\target\surefire.properties in working directory C:\Users\nicol\git\scala-ide\org.scala-ide.sdt.core.tests
at org.eclipse.tycho.surefire.AbstractEclipseTestMojo.runTest (AbstractEclipseTestMojo.java:1054)
at org.eclipse.tycho.surefire.AbstractEclipseTestMojo.runTests (AbstractEclipseTestMojo.java:639)
at org.eclipse.tycho.surefire.AbstractTestMojo.execute (AbstractTestMojo.java:233)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:52)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:161)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:73)
Upvotes: -1
Views: 133
Reputation: 1382
The reason is an unsupported jvm argument :
-XX:+UnsyncloadClass
The errors are not output to the console even in debug mode (-e -X). The java command has to be run separately to see the error:
Unrecognized VM option 'UnsyncloadClass'
Upvotes: 1