Java 分叉的虚拟机没有适当地说再见就终止了。调用VM崩溃或System.exit
请帮我解决这个问题。我不太明白日志中的错误是什么意思Java 分叉的虚拟机没有适当地说再见就终止了。调用VM崩溃或System.exit,java,maven-surefire-plugin,opendaylight,Java,Maven Surefire Plugin,Opendaylight,请帮我解决这个问题。我不太明白日志中的错误是什么意思 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21.749s [INFO] Finished
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.749s
[INFO] Finished at: Thu Apr 24 10:10:20 IST 2014
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on project samples.simpleforwarding: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command wascmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_55\jre\bin\java" -Xmx1024m -XX:MaxPermSize=256m -jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefirebooter53410321571238933.jar E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire86076271125218001tmp E:\OpenDayLight\controller\opendaylight\samples\simpleforwarding\target\surefire\surefire_01846991116135903536tmp"
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
这部分内容可以帮助您:
Surefire失败,并显示消息“forked VM在未正确告别的情况下终止”
Surefire在任何时候都不支持调用System.exit()的测试或任何引用库。如果他们这样做,他们与surefire不兼容,您可能应该向库/供应商提交问题。或者,分叉的VM也可能由于多种原因崩溃,这也可能导致此问题的发生。查找表示VM崩溃的经典“hs_err*”文件,或者在测试执行时检查运行maven的日志输出。崩溃进程的某些“异常”输出可能会转储到控制台/日志。如果这种情况发生在CI环境中,并且只有在运行一段时间后,测试套件才有可能泄漏某种操作系统级资源,这会使每次运行的情况变得更糟。常规操作系统级监控工具可能会给您一些提示
您需要检查您的机器是64位还是32位。如果您的机器是32位的,那么您的内存参数不应该超过4096,甚至应该低于4GB。
但是,如果您的机器是64位的,请安装Java 64位,并在mvn.bat中提供指向Java 64位安装的Java_HOME。我今天也遇到了同样的问题,对我来说,真正的问题在日志中进一步报告,消息是
不能使用小于1的threadCount参数;1>0
。
在surefire插件配置中添加1
时,其他错误消失
完整插件配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<configuration>
<threadCount>1</threadCount>
</configuration>
</plugin>
org.apache.maven.plugins
maven surefire插件
2.18.1
org.apache.maven.surefire
surefire-junit47
2.18.1
org.apache.maven.surefire
surefire测试
2.18.1
1.
…是的,出于向后兼容性的原因,我在这个测试框架中同时使用junit和testng。我遇到了同样的问题,并通过添加以下内容解决了这个问题:
-Xmx1024m-XX:MaxPermSize=256m
整个插件元素是:
org.apache.maven.plugins
maven surefire插件
3.
真的
-Xmx1024m-XX:MaxPermSize=256m
如果有人包含自定义argLine参数,您必须重新考虑,因为这可能是内存分配问题的根源
例如(我以前有):
XX:MaxPermSize=4096m${argLine}
现在我使用硬指定值:
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
-Xmx1024m-XX:MaxPermSize=256m
无论出于何种原因,与Surefire集成的应用程序(如Jacoco)请求的内存不足,无法与构建时进行的测试共存。在Jenkins在Ubuntu机器上构建时,我遇到了这个问题
/var/log/syslog
报告内存不足:杀死进程19557(java)得分207或牺牲子进程
。从那时起,问题就消失了。在JDK 1.8.0上使用Jacoco插件运行mvn命令时遇到了类似的问题
[INFO]
A fatal error has been detected by the Java Runtime Environment:
JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17).........
Problematic frame:
PhaseIdealLoop::build_loop_late_post(Node*)+0x144
............
............
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test) on project
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
JDK中有一个bug
解决方案是使用param-XX:-UseLoopPredicate运行mvn clean install
或者只是对JDK进行更新(我认为较新的次要版本有效)在运行JAVA=1.8的windows 10环境中,我尝试编译一个设置为1.7的maven项目时遇到了相同的问题 我通过将java版本从1.7更改为1.8解决了这个问题,如下所示
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
org.apache.maven.plugins
maven编译器插件
3.3
1.8
1.8
我最近在用竹子构建容器化jar应用程序时遇到了这个错误:
org.apache.maven.surefire.booter.surefirebooterworkexception:分叉的VM没有正确地说再见就终止了
经过几个小时的研究,我把它修好了。我认为在这里分享我的解决方案会很有用
因此,每次在docker容器中为java应用程序运行mvn clean package
命令时,都会发生错误。我不是Maven专家,但问题在于SpringBoot中作为Maven依赖项包含的Surefire和Junit4插件
要修复它,您需要将Junit4替换为Junit5,并覆盖您的pom.xml
中的Surefire插件
1.内部spring引导依赖项插入排除:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<!-- FIX BAMBOO DEPLOY>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
<!---->
</dependency>
org.springframework.boot
弹簧起动试验
测试
二,。添加新的Junit5依赖项:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
org.junit.jupiter
JUnitJupiter api
测试
org.junit.jupiter
朱尼特木星发动机
5.1.0
测试
org.junit.vintage
朱尼特老式发动机
5.1.0
测试
org.junit.platform
junit平台发射器
1.1.0
测试
org.junit.platform
junit平台跑步者
1.1.0
测试
org.junit.platform
junit平台surefire提供程序
1.1.0
测试
三,。在插件部分插入新插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>
org.apache.maven.plugins
maven故障保护插件
org.apache.maven.plugins
maven surefire插件
2.19.1
org.junit.platform
junit平台surefire提供程序
1.1.0
org.junit.jupiter
朱尼特木星发动机
5.1.0
这应该足以修复竹子建筑。别忘了还要转换所有Junit4测试以支持Junit5 我遇到了非常类似的问题(),并找到了三种适合我的解决方案: 问题描述 问题在于maven pluginmaven surefire plugin仅在版本2.20.1和2.21.0中存在。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
mvn clean install
mvn clean install > log-file.log
Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
<profiles>
<profile>
<id>SUREFIRE-1588</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>
</properties>
</profile>
</profiles>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--these strange settings fixes a chrash and dumpstream from surefire when run from command line
Caused by: java.lang.ClassNotFoundException: org.apache.maven.surefire.booter.ForkedBooter
-->
<useSystemClassLoader>true</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
</configuration>
</plugin>
# Created at 2018-11-14T14:28:15.629
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006c7500000, 522190848, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455)
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
mvn test -DargLine="-Djdk.net.URLClassPath.disableClassPathURLCheck=true"
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<skip>false</skip>
<reuseForks>false</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<argLine>-Dfile.encoding=UTF-8</argLine>
<useSystemClassLoader>false</useSystemClassLoader>
<includes>
<!--Test* classes for the app testing -->
<include>**/directory/Test*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>