gpt4 book ai didi

linux - 测试在 Jenkins 上损坏但在本地运行

转载 作者:太空宇宙 更新时间:2023-11-04 03:46:01 26 4
gpt4 key购买 nike

我们遇到了一个奇怪的错误。我们的测试在本地计算机(Windows)中运行,但不在 jenkins(linux)上运行。

我们得到一个

Caused by: java.lang.RuntimeException: There was an error in the forked process
java.lang.NoClassDefFoundError:

我正在寻找解决方案并在 bugzilla 上获取了此信息或archive .

有人知道这个问题以及如何解决它吗?

谢谢

更新

maven-surefire-plugin 也在父 pom.xml 中定义,以便与 cobertura 一起使用。测试运行两次,但第二次测试失败,如上所述。

我在本节中定义了 2 个使用 Surefire-plugin 的配置文件和一个 Surefire 插件定义。

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*SoapUiTest.java</exclude>
</excludes>
<excludes>
<!--exclude>**/*.java</exclude -->
</excludes>
<additionalClasspathElements>
<additionalClasspathElement>${basedir}/src/main/java</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>soapUi</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EntityTest.java</exclude>
</excludes>
<includes>
<include>**/*SoapUiTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EntityTest.java</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

我做错了什么?

最佳答案

我记得有类似的问题。它可能与 ulimit - 允许打开的文件数有关。 ClassLoader需要打开文件进行加载。由于类未加载/可用,因此在方法调用时会引发 NoClassDefFoundError 。检查可以打开多少个文件:

ulimit -a

要增加打开文件的数量:

ulimit -n NEW_NUMBER

为了永久更改它,请按照this link中的说明进行操作。

Follow the steps:

vi /etc/security/limits.conf and add below the mentioned

  • soft nofile 65535
  • hard nofile 65535

关于linux - 测试在 Jenkins 上损坏但在本地运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28169339/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com