小编Nit*_*man的帖子

调试surefire的策略"分叉的虚拟机终止而没有说再见.虚拟机崩溃或System.exit被调用?"

我正在开发一个相当复杂的java项目,它有许多依赖项和许多单元测试.

我在mac(mavericks)上使用java 1.6.0_65,使用maven 3.0.5和maven-surefire-plugin:2.16在几个forks中运行.我的问题是使用多个forks运行此设置会导致fork退出:

"分叉的虚拟机终止了,没有说再见.虚拟机崩溃或System.exit调用?"

只使用一个fork运行它不会产生问题(并且一切都通过)

有一些关于这个问题的信息包括这个StackOverflow问题这个万无一失的bug(现在似乎已经解决了)

我知道这种情况的"答案"是在我的代码中找到什么叫System.exit() - 我找不到任何东西.

或者是什么原因导致我的JVM崩溃 - 没有hs_pid崩溃报告.

我的问题是我可以用什么样的策略来找到找到这个原因的? 为了澄清,我对上面提到的答案不感兴趣,但是找到它的起源.(或者甚至更好地回答可能造成这种情况的不同答案)


我的Surefire配置是:(但我确实尝试过其他组合)

<parallel>classes</parallel>
<threadCount>1</threadCount>
<forkCount>1C</forkCount>
<reuseForks>false</reuseForks>
<useSystemClassLoader>false</useSystemClassLoader>
<useManifestOnlyJar>true</useManifestOnlyJar>
<useFile>true</useFile>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<runOrder>alphabetical</runOrder>
Run Code Online (Sandbox Code Playgroud)

在使用--debug(-X)运行maven目标后添加#1添加相关的输出

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project event-logger: ExecutionException; nested exception is java.util.concurrent.ExecutionException: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command was/bin/sh -c cd /Users/nitzan/work/nitzan_5_parallel_tests/event-logger && /Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home/bin/java org.apache.maven.surefire.booter.ForkedBooter /Users/nitzan/work/nitzan_5_parallel_tests/event-logger/target/surefire/surefire5107531798951225850tmp /Users/nitzan/work/nitzan_5_parallel_tests/event-logger/target/surefire/surefire_12561116468761732560tmp
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to …
Run Code Online (Sandbox Code Playgroud)

java maven maven-surefire-plugin

29
推荐指数
4
解决办法
3万
查看次数

在jenkins中运行maven/surefire构建时间歇性的NoClassDefFoundError

我们正在Jenkins上构建一个大型的多模块Maven项目,包括运行大量的单元测试.

每隔几个构建版本构建失败NoClassDefFoundError on RunListener- 它位于单元jar中.从下面的日志中可以看出 - JUnit包含在类路径中.

该错误似乎完全随机出现.

日志

Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project taboola-svc: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: A required class was missing while executing org.apache.maven.plugins:maven-surefire-plugin:2.17:test: org/junit/runner/notification/RunListener
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-surefire-plugin:2.17
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/builder/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.17/maven-surefire-plugin-2.17.jar
[ERROR] urls[1] = file:/home/builder/.m2/repository/org/apache/maven/surefire/surefire-junit47/2.17/surefire-junit47-2.17.jar
[ERROR] urls[2] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-junit48/2.17/common-junit48-2.17.jar
[ERROR] urls[3] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-junit4/2.17/common-junit4-2.17.jar
[ERROR] urls[4] = file:/home/builder/.m2/repository/org/apache/maven/surefire/common-junit3/2.17/common-junit3-2.17.jar
[ERROR] urls[5] = file:/home/builder/.m2/repository/org/apache/maven/surefire/surefire-grouper/2.17/surefire-grouper-2.17.jar
[ERROR] urls[6] = …
Run Code Online (Sandbox Code Playgroud)

java junit surefire maven jenkins

15
推荐指数
1
解决办法
9476
查看次数

如果用户未登录Facebook,则不会触发FB.getLoginStatus

我正在开发一个与Facebook集成的Facebook应用程序,我正试图获得用户的FB会话.据我了解,常见的使用场景如下.

  1. 呼叫 FB.init()
  2. 打电话FB.getLoginStatus给它一个适当的回调.

我运行了以下代码(应用程序ID).

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
    <!--

    function init(){
        FB.init({
            appId  : '9999999999999',
            status : true, // check login status
            cookie : true, // enable cookies to allow the server to access the session
            xfbml  : true, // parse XFBML
            channelUrl : 'http://127.0.0.1:8888/channel.html', // custom channel
            oauth  : true // enable OAuth
        });
        alert('going to call FB.getLoginStatus ');

        FB.getLoginStatus(function(response) {
            alert('whoo hoo!!! getLoginStatus called the callback');
        });
    }
    init();
    //-->
</script>
Run Code Online (Sandbox Code Playgroud)

如果用户已在同一浏览器会话中登录到Facebook,则一切都按预期工作 - …

javascript facebook oauth oauth-2.0

10
推荐指数
1
解决办法
8919
查看次数