尝试通过运行“ MVN测试”来运行测试时,JVM崩溃

时间:2019-09-26 04:53:12

标签: java maven

注意:我现在知道The forked VM terminated without saying properly goodbye. VM crash or System.exit called,我尝试了在那里表达的许多解决方案,但没有一个起作用或没有任何作用。我在这个问题中记录了我尝试了什么以及发生了什么。我基本上不认为这是该问题的重复部分,因为没有答案被接受,因此我们无法知道错误的真正原因是什么,并且许多不同的问题都可能导致相同的错误(并非所有崩溃都是相同的) )。

当我尝试运行测试时,我正在恢复一个处于中断状态的项目,我收到此错误:

[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

我无法回到已知的工作状态,因为,好吧,我不知道那是什么时候发生的,在什么条件下发生。

这是命令的完整输出:

> mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------< com.example:projectxserver >--------------------
[INFO] Building projectxserver 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The artifact org.hibernate:hibernate-validator:jar:6.0.17.Final has been relocated to org.hibernate.validator:hibernate-validator:jar:6.0.17.Final
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ projectxserver ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 15 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ projectxserver ---
[WARNING] ***********************************************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [javax.servlet-api-4.0.1.jar, javax.inject-1.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] ***********************************************************************************************************************************************************************
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ projectxserver ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ projectxserver ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ projectxserver ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file C:\Users\pupeno\Documents\projectx\code\projectxserver\target\surefire-reports\2019-09-26T05-51-30_012-jvmRun1.dumpstream
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.748 s
[INFO] Finished at: 2019-09-26T05:51:32+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project projectxserver: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\pupeno\Documents\projectx\code\projectxserver\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "C:\Users\pupeno\scoop\apps\oraclejdk\current\bin\java @C:\Users\pupeno\AppData\Local\Temp\surefire12697495595942050464\surefireargs12476787747337053319 C:\Users\pupeno\AppData\Local\Temp\surefire12697495595942050464 2019-09-26T05-51-30_012-jvmRun1 surefire10872047683044717734tmp surefire_013239801033816370074tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "C:\Users\pupeno\scoop\apps\oraclejdk\current\bin\java @C:\Users\pupeno\AppData\Local\Temp\surefire12697495595942050464\surefireargs12476787747337053319 C:\Users\pupeno\AppData\Local\Temp\surefire12697495595942050464 2019-09-26T05-51-30_012-jvmRun1 surefire10872047683044717734tmp surefire_013239801033816370074tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:282)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1183)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1011)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:857)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]         at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR]
[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/MojoExecutionException

目前不确定什么信息是相关的,我很高兴在此问题上添加所需的内容。

我尝试了OpenJDK 11、12和OracleJDK 12以及maven-sure-fire-plugin 2.22.2和3.0.0-M3。都给出相同的错误。

我尝试将mvn清理干净并重新构建。我尝试删除整个Maven存储库.m2目录。

我也尝试按照The forked VM terminated without saying properly goodbye. VM crash or System.exit called<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>的说明添加<argLine>-Xmx2048m -XX:MaxPermSize=1024m</argLine>只是为了确保,但是错误仍然相同。我仅在Oracle JDK 12上尝试过此操作。

我也尝试过:

<configuration>
    <forkCount>3</forkCount>
    <reuseForks>true</reuseForks>
    <argLine>-Xmx2048m -XX:MaxPermSize=1024m</argLine>
</configuration>

以防其他两个参数相关并且由于以下错误而失败:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project dashmanserver: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test failed: java.lang.ClassNotFoundException: org.apache.maven.plugin.surefire.StartupReportConfiguration -> [Help 1]

我尝试添加<testFailureIgnore>true</testFailureIgnore>,但遇到相同的错误。

1 个答案:

答案 0 :(得分:0)

有同样的问题;构建可以在一台机器上运行,但不能在另一台机器上运行。

故障机器上的Maven登录中提到“转储”文件,例如\ xxx \ target \ surefire-reports \ 2020-05-12T17-21-34_124.dumpstream

窥视发现:

    # Created at 2020-05-12T17:21:35.135
    Ursache: java.lang.ClassNotFoundException: LastName\/m2\repository\javax\servlet\javax/servlet-api\4/0/1\javax/servlet-api-4/0/1/jar;C:\Users\FirstName

因此,事实证明我将“ c:\ users \ FirstName LastName”作为用户目录,例如我的用户名中有一个空格,我会假设由于servlet-api 4.0.1没有module-info.class,所以我相信在MANIFEST.MF中进行一些查找。

构建正常运行的另一台机器的用户目录名称中没有空格。

奇怪的是,它仅在运行测试时发生,并且对于maven-surefire-plugin而言useModulePath是true还是false似乎无关紧要