An unexpected error occurred while launching the test runtime

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:UsersnicolDownloadsjdk-17.0.4_windows-x64_binjdk-17.0.4binjava.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:Usersnicol.m2repositoryp2osgibundleorg.eclipse.equinox.launcher1.6.700.v20240213-1244org.eclipse.equinox.launcher-1.6.700.v20240213-1244.jar -debug -consolelog -data C:Usersnicolgitscala-ideorg.scala-ide.sdt.core.teststargetworkdata -install C:Usersnicolgitscala-ideorg.scala-ide.sdt.core.teststargetwork -configuration C:Usersnicolgitscala-ideorg.scala-ide.sdt.core.teststargetworkconfiguration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties C:Usersnicolgitscala-ideorg.scala-ide.sdt.core.teststargetsurefire.properties in working directory C:Usersnicolgitscala-ideorg.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:UsersnicolDownloadsjdk-17.0.4_windows-x64_binjdk-17.0.4</jdkHome>
      </configuration>
   </toolchain>
</toolchains>

But I’m still having the issue. What did I miss ?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật