java虚拟机异常终止_“叉式Java虚拟机退出异常”错误从junit测试(“Forked Java VM exited abnormally” error from junit tests)...

“叉式Java虚拟机退出异常”错误从junit测试(“Forked Java VM exited abnormally” error from junit tests)

我有一个java junit测试,当在开发机器上单独运行时通过。 我们还有一个hudson工作,它运行所有的测试,通过ant调用,在Mac OS X 10.4节点上使用Java 1.5。 测试通过hudson构建直到最近,但现在(没有相关的代码更改)一个测试失败,每次都出现以下错误:

错误信息

分叉的Java VM异常退出。 请注意,报告中的时间并不反映虚拟机退出之前的时间。

堆栈跟踪

junit.framework.AssertionFailedError:Forked Java VM异常退出。 请注意,报告中的时间并不反映虚拟机退出之前的时间。

谷歌搜索显示许多其他人似乎遇到同样的问题,但我找不到任何答案。

I have a java junit test that passes when run alone on a development machine. We also have a hudson job which runs all the tests, invoked via ant, on a Mac OS X 10.4 node with Java 1.5. The test was passing in the hudson build until recently but now (with no related code changes) one test fails everytime with the following error:

Error Message

Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

Stacktrace

junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

googling shows many others seem to have run into the same problem but there I couldn't find any answer.

原文:https://stackoverflow.com/questions/1846329

更新时间:2019-11-20 01:05

最满意答案

我面临着类似的问题。 我运行junit测试作为一个蚂蚁任务。 我添加了showoutput =“yes” ant junit属性并运行ant junit任务。 然后显示导致分叉jvm退出的异常堆栈跟踪。

I faced a similar issue. I ran the junit tests as an ant task. I added the showoutput="yes" ant junit property and ran the ant junit task. It then showed the exception stack trace that caused the forked jvm to exit.

2015-03-28

相关问答

我如何处理这个问题就是安装一个在调用System.exit时引发异常的安全管理器。 然后有代码捕捉异常并且不会使测试失败。 public class NoExitSecurityManager

extends java.rmi.RMISecurityManager

{

private final SecurityManager parent;

public NoExitSecurityManager(final SecurityManager manager)

{

...

我面临着类似的问题。 我运行junit测试作为一个蚂蚁任务。 我添加了showoutput =“yes” ant junit属性并运行ant junit任务。 然后显示导致分叉jvm退出的异常堆栈跟踪。 I faced a similar issue. I ran the junit tests as an ant task. I added the showoutput="yes" ant junit property and ran the ant junit task. It then sh

...

Grails是一种真正的记忆力。 在设置和变量的所有更改之后,没有任何工作,我决定关闭所有应用程序以释放RAM空间(特别是Chrome选项卡, 它占用了大部分RAM )。 然后我开始使用grails应用程序并且它有效。 Grails is a real memory hog. After all the changes in the setting and variables, out of which nothing worked, I have decided to close all my

...

尝试使用嵌套的syspropertyset元素。 请参阅junit文档 Try using a nested syspropertyset element. See junit documentation

您的程序正在为某些输入调用System.exit(0) 。 不要那样做! 这正是消息告诉你的内容:在评分代码完成之前,JVM退出文本中间。 而不是调用exit() ,只需使用return从main()返回。 Your program is calling System.exit(0) for certain inputs. Don't do that! That's exactly what the message is telling you: that the JVM exited in th

...

问题是,在(非常长的)类路径中有一个旧的ant贡献了一个旧版本的ant,神秘地使JVM崩溃。 Problem was that there was an old ant contribution for an older version of ant in the (very long) classpath that mysteriously made the JVMs crash.

看来我把TestNg和JUnit混淆了。 看看我误用的进口产品: import org.testng.annotations.AfterClass;

import org.testng.annotations.BeforeClass;

import org.testng.annotations.Test;

It seems I have confused TestNg with JUnit. Look at the imports I mistakingly used: import org.t

...

好吧,显然你需要先编译Java代码才能运行它: language: java

jdk:

- oraclejdk7

script:

- javac TestRunner

- java TestRunner

当您使用JUnit时,您还需要在类路径中拥有它。 对于最小化设置,您可以在代码之外放置必要的罐子并使用 java -classpath junit.jar;hamcrest-core.jar TestRunner

但我认真建议使用像maven或gradle这样的依赖管理系统。 We

...

public void IsPrimeTest(String numA, boolean expected) {

应该 public IsPrimeTest(String numA, boolean expected) {

你的构造函数不能有返回类型,否则它不是构造函数。 public void IsPrimeTest(String numA, boolean expected) {

should be public IsPrimeTest(String numA, boolean expe

...

当我看到这个时,通常意味着我的单元测试一旦出现错误的逻辑并导致otest崩溃。 这不是一个非常有用的答案,因为代码139不是一个非常有用的错误代码。 抱歉! When I've seen this, it usually means that once of my unit tests has faulty logic and has caused otest to crash. This isn't a terribly helpful answer, because code 139 isn'

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值