启动maven wildfly插件时出现异常:服务器未能在60秒内启动

Exception when starting maven wildfly plugin: server failed to start within 60 seconds

当我将它加载到我的系统时,我有一个从 bit-bucket 克隆的项目。 maven 下载了它的所有依赖项,但显然当 maven wildfly 插件服务器启动和 运行 集成测试时,我收到一个错误。 maven wildfly 插件无法在 60 秒内启动。我的老板早些时候说是我的电脑 运行 正在使用 2gb 内存,我不得不升级到 4gb 内存,但是当我尝试启动服务器时,我仍然遇到同样的错误。

我附上了我的堆栈跟踪,如果有人可以帮助我解决有关使服务器在指定时间内启动的问题。谢谢你。

Caused by: java.util.concurrent.TimeoutException: The server did not start within 60 seconds.
at org.wildfly.plugin.core.ServerHelper.waitForStandalone (ServerHelper.java:318)
at org.wildfly.plugin.server.StartMojo.execute (StartMojo.java:290)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[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
 'cmd' is not recognized as an internal or external command,

可运行的程序或批处理文件。

您可以在 pom.xml 中设置一个 属性 来增加超时时间: https://docs.jboss.org/wildfly/plugins/maven/latest/deploy-mojo.html#timeout

应该看起来像这样:

        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>2.0.0.Final</version>
            <configuration>
               <timeout>300</timeout>
            </configuration>
        </plugin>

您也可以将其设置为 属性 在您 pom.xml

<properties>
  <wildfly.timeout>300</wildfly.timeout>
</properties>

如果您想将超时阈值增加到 300 秒

除了askepan提到的配置之外,您还可以设置startupTimeout 属性

野蝇:开始

startupTimeout - long: The timeout value to use when starting the server. Default value is: 60. User property is: wildfly.startupTimeout. Alias is: startup-timeout.

https://docs.jboss.org/wildfly/plugins/maven/latest/start-mojo.html#startupTimeout

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.2.2.Final</version>
    <configuration>
       <startupTimeout>300</startupTimeout>
    </configuration>
</plugin>