Cargo - Jetty9 - 尝试启动webapp时出现意外错误

时间:2014-08-21 16:23:08

标签: maven-2 jetty cargo maven-cargo jetty-9

我一直在向远程Jetty 9部署战争。

在应用程序服务器端,我已经部署了货物码头-7-and -wards-deployer(版本1.4.9)。该组件似乎正在正确运行并响应(正如get请求中所预期的那样):

  

HTTP ERROR 400

     

访问/ cargo-jetty-deployer /的问题。原因:       命令/未知由Jetty提供://

要使用此配置部署我正在使用cargo-maven2-plugin(版本1.4.9):

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>${cargo.plugin.version}</version>
    <configuration>

            <container>
                <containerId>jetty9x</containerId>
                <type>remote</type>
            </container>

            <configuration>
                <type>runtime</type>
                <properties>
                    <cargo.servlet.port>80</cargo.servlet.port>
                    <cargo.hostname>ipgoeshere</cargo.hostname>
                    <cargo.protocol>http</cargo.protocol>
                </properties>
            </configuration>

            <deployables>
                <deployable>
                    <groupId>se.dn.nav</groupId>
                    <artifactId>nav-api</artifactId>
                    <type>war</type>
                    <properties>
                        <context>/api</context>
                    </properties>
                </deployable>
            </deployables>

    </configuration>
</plugin>

运行时:mvn cargo:deploy

这导致以下错误消息:

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.9:deploy (default-cli) on project nav-api: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.9:deploy failed: Failed to deploy [/var/lib/jenkins/jobs/Deploy-Stage/workspace/target/nav-api-1.2.war]: Response when calling http://ip:80/cargo-jetty-deployer/deploy?path=/api was: Error - Unexpected error when trying to start the webapp -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.9:deploy (default-cli) on project nav-api: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.9:deploy failed: Failed to deploy [/var/lib/jenkins/jobs/Deploy-Stage/workspace/target/nav-api-1.2.war]
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    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)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.9:deploy failed: Failed to deploy [/var/lib/jenkins/jobs/Deploy-Stage/workspace/target/nav-api-1.2.war]
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: org.codehaus.cargo.container.ContainerException: Failed to deploy [/var/lib/jenkins/jobs/Deploy-Stage/workspace/target/nav-api-1.2.war]
    at org.codehaus.cargo.container.jetty.JettyRemoteDeployer.deploy(JettyRemoteDeployer.java:126)
    at org.codehaus.cargo.maven2.DeployerDeployMojo.performDeployerActionOnSingleDeployable(DeployerDeployMojo.java:56)
    at org.codehaus.cargo.maven2.AbstractDeployerMojo.performDeployerActionOnAllDeployables(AbstractDeployerMojo.java:166)
    at org.codehaus.cargo.maven2.AbstractDeployerMojo.doExecute(AbstractDeployerMojo.java:97)
    at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:432)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    ... 20 more
Caused by: org.codehaus.cargo.container.ContainerException: Response when calling http://ip:80/cargo-jetty-deployer/deploy?path=/api was: Error - Unexpected error when trying to start the webapp

    at org.codehaus.cargo.container.jetty.JettyRemoteDeployer.deploy(JettyRemoteDeployer.java:119)
    ... 25 more
[ERROR] 
[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/PluginExecutionException

在此之后,构建和部署失败。

我已经检查了Jetty上的日志,我还将日志级别提升到了DEBUG,但没有迹象表明服务器端出了什么问题。

有没有人知道我做错了什么? 有什么方法可以得到更好的错误信息来表明出错了吗?

任何帮助都会非常感激! :)

P.S。 我已经删除了日志中的ip。

P.s.s。 我正在部署的战争之前经过测试,在Jetty上运行良好。

2 个答案:

答案 0 :(得分:0)

似乎cargo-jetty-7-and-onwards-deployer与Jetty 9+不兼容(Jetty 9中有一些生命周期变化,货物可能不知道)

这样做(找出)......

  1. 使用以下额外命令行启动jetty

      

    java -jar /opt/jetty/start.jar -Dorg.LEVEL = DEBUG -Djetty.dump.start = true

  2. 检查日志,应该有更多信息,包括服务器状态转储。 如果cargo-jetty-deployer不存在或未标记为STARTED,则部署者webapp本身无法启动。

  3. 如果您愿意,请使用转储和/或相关的webapp启动错误记录事件更新您的问题(而不是整个日志,因为这只是嘈杂)

答案 1 :(得分:0)

对我来说有用的是将config.home系统属性设置为Jetty的webapps目录的父目录。

部署者将上传的战争复制到webapps目录,让Jetty自动部署。

如果设置了config.home,那么部署者将使用${config.home}/webapps,否则它将使用${jetty.home}/webapps作为war文件的目标目录。对我来说,webapps目录配置为${jetty.base}/webapps,这与${jetty.home}/webapps不同。设置${config.home}等于${jetty.base}可以解决问题。