docker 启动fork时出现Maven错误,检查日志中的输出

6yjfywim  于 12个月前  发布在  Docker
关注(0)|答案(7)|浏览(127)

我使用的是Maven、docker-maven-plugin和Sping Boot 。现在我遇到了以下问题:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:08 min
[INFO] Finished at: 2018-03-30T20:31:08+03:00
[INFO] Final Memory: 76M/1162M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.20.1:verify (default) on project domain: There are test failures.
[ERROR]
[ERROR] Please refer to D:\Projects\decisionwanted\domain\target\failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[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:\Java\jdk1.8.0_162\jre\bin\java -jar C:\Users\ALEXAN~1\AppData\Local\Temp\surefire7684467242957210997\surefirebooter6934205730694228299.jar C:\Users\Alexander\AppData\Local\Temp\surefire7684467242957210997 2018-03-30T20-28-03_824-jvmRun1 surefire8708053899862809316tmp surefire_06397887630134904290tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] Crashed tests:
[ERROR] com.decisionwanted.domain.DecisionCharacteristicIT
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:686)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:535)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:280)
[ERROR]         at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
[ERROR]         at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832)
[ERROR]         at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR]         at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[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:51)
[ERROR]         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR]         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR]         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR]         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
[ERROR]         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
[ERROR]         at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR]         at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] -> [Help 1]

字符串
我读到这个问题可能与maven-surefire-plugin有关,所以我在我的父pom中添加了:

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <forkCount>0</forkCount>
            </configuration>
        </plugin>
    <plugins>
</pluginManagement>


和继承的POMS:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
    </plugin>
</plugins>


但没有用。
如何解决此问题?

a8jjtwal

a8jjtwal1#

我在本地环境中也遇到了这个问题(build在其他环境中工作得很好)。所以我没有修改pom.xml,而是添加了forkCount=0作为命令行参数,它解决了这个问题。比如:

mvn clean install -DforkCount=0

字符串

lokaqttq

lokaqttq2#

我也面临着同样的问题。

[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log

字符串
在我的上下文中,我正在构建一个Sping Boot 应用程序。所有测试都正常,但是,由于应用程序代码关闭过程中的问题,应用程序没有正确关闭。我猜该过程没有返回等于0的退出代码。
一旦我们修复了这个关闭问题,这个surefire插件异常就不再发生了。
这可能是对你问题的一个提示。

ftf50wuq

ftf50wuq3#

我也面临着同样的问题,添加下面为我工作:版本3.0.0-M3修复了这个问题

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M3</version>
    <configuration>
        <forkCount>0</forkCount>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>

字符串

bkkx9g8r

bkkx9g8r4#

我也有类似的错误,因为我的分支名称中有一个破折号-,Jenkins失败了。

[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] 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:671) 
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533) 
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278) 
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244) 
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149) 
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978) 
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:854)

字符串
在用另一个名字做了一个相同的分支后,我又工作了。

h5qlskok

h5qlskok5#

将useSystemClassloader设置为false:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <useSystemClassLoader>false</useSystemClassLoader>
    </configuration>
</plugin>

字符串

8ulbf1ek

8ulbf1ek6#

除了aure_bobo回答谁说遗留代码可能导致退出代码!= 0:
在我的情况下,我有我的IT阶段所有的成功,并得到了这个错误的CI/CD只:我无法诊断/再现本地:所以无法知道为什么和哪个模块出错的surefire分叉关闭:没有堆栈跟踪从surefire 3.0.0-M5 code,因为它不是一个超时。
所以我使用了这个技巧:

  • 要排除应用程序故障,请暂时将故障保护插件配置为永不分叉(doc:forkMode>never):
<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${maven-failsafe-plugin.version}</version>
          <configuration>
              <!-- (...) -->
              <forkMode>never</forkMode>
              <!-- (...) -->
          </configuration>

字符串
在我的例子中,有了这个技巧,我能够重现:所有IT都成功了,然后在关闭时得到了完整的堆栈跟踪。

bfhwhh0e

bfhwhh0e7#

我试图在包含“&”的文件夹中执行应用程序。
删除特殊字符后,它得到执行没有问题。

相关问题