无法从 Cargo 部署到 Tomcat7

发布于 2024-12-08 12:20:50 字数 3639 浏览 2 评论 0原文

我正在尝试通过 https 使用来自 Maven 的 Cargo 部署到远程 Tomcat7。

我已经设置了管理员脚本角色,并且到目前为止我已经成功地能够远程取消部署应用程序。

我所拥有的看起来像这样:

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.1.2</version>
    <configuration>
        <container>
            <containerId>tomcat7x</containerId>
            <type>remote</type>
        </container>

        <configuration>
            <type>runtime</type>
            <properties>
                <cargo.remote.uri>https://xxx/manager/text</cargo.remote.uri>
                <cargo.remote.username>${tomcat.username}</cargo.remote.username>
                <cargo.remote.password>${tomcat.password}</cargo.remote.password>
            </properties>
        </configuration>

        <deployer>
            <type>remote</type>
            <deployables>
                <deployable>
                    <groupId>mycomp</groupId>
                    <artifactId>myartifact</artifactId>
                    <type>war</type>
                    <properties>
                        <context>/</context>
                    </properties>
                </deployable>
            </deployables>
        </deployer>

    </configuration>
</plugin>

嗯,我知道凭据,一切都设置正确,并且我使用了新的 /text 界面,并且我已经能够取消部署现有的应用程序。但是当尝试运行部署时:

mvn cargo:deployer-deploy -e

我收到一个错误,其根本原因是:

Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2809)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2792)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.pipe(TomcatManager.java:605)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:501)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:569)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:273)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:256)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:240)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:101)
... 25 more

我立即得到它,所以它不会超时。

文件可以太大吗?这是一场 60MB 的战争。我确保我的 nginx 允许更大:

client_max_body_size 200M;

我还在管理器 webapps web.xml 中的文本管理器中添加了多部分配置,如下所示:

servlet> 经理 org.apache.catalina.manager.ManagerServlet 调试 2

<multipart-config>
  <max-file-size>209715200</max-file-size>
  <max-request-size>209715200</max-request-size>
  <file-size-threshold>0</file-size-threshold>
</multipart-config>

http:// nexnet.wordpress.com/2011/04/27/large-war-file-cannot-be-deployed-in-tomcat-7/

我在很多方面都喜欢 Maven,但是错误举报真的很可怕。非常感谢任何帮助。

I'm trying to deploy to a remote Tomcat7 with Cargo from Maven over https.

I've set up manager-script role and I've succeeded so far as to have been able to undeploy an app remotely.

What I have looks like this:

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.1.2</version>
    <configuration>
        <container>
            <containerId>tomcat7x</containerId>
            <type>remote</type>
        </container>

        <configuration>
            <type>runtime</type>
            <properties>
                <cargo.remote.uri>https://xxx/manager/text</cargo.remote.uri>
                <cargo.remote.username>${tomcat.username}</cargo.remote.username>
                <cargo.remote.password>${tomcat.password}</cargo.remote.password>
            </properties>
        </configuration>

        <deployer>
            <type>remote</type>
            <deployables>
                <deployable>
                    <groupId>mycomp</groupId>
                    <artifactId>myartifact</artifactId>
                    <type>war</type>
                    <properties>
                        <context>/</context>
                    </properties>
                </deployable>
            </deployables>
        </deployer>

    </configuration>
</plugin>

Well, I know the credentials and everything is setup correctly, and I have used the new /text interface and I have been able to undeploy an existing app. But when trying to run deploy:

mvn cargo:deployer-deploy -e

I get an error with root cause:

Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:2809)
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:2792)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.pipe(TomcatManager.java:605)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:501)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:569)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:273)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:256)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:240)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:101)
... 25 more

I get it quite immediately so it can't be a timeout.

Can the file be to large? It's a 60 MB war. I made sure my nginx allows bigger:

client_max_body_size 200M;

I also added multipart config to the text manager in the manager webapps web.xml like this:

servlet>
Manager
org.apache.catalina.manager.ManagerServlet

debug
2

<multipart-config>
  <max-file-size>209715200</max-file-size>
  <max-request-size>209715200</max-request-size>
  <file-size-threshold>0</file-size-threshold>
</multipart-config>

http://nexnet.wordpress.com/2011/04/27/large-war-file-cannot-be-deployed-in-tomcat-7/

I love Maven in many ways, but the error reporting is really terrible. Any help highly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

猫瑾少女 2024-12-15 12:20:50

最近,当我尝试 cargo:deploy 一个工件时,我就被这个错误困扰了。通常我们会在部署之前停止、清理并启动 webapps 目录,但这次我注意到有一个工件没有被删除。

切换到 cargo:redeploy 后,错误得到解决。

I was bitten by this error recently, when I tried to cargo:deploy an artifact. Usually we stop, clean and start the webapps directory before deploying, but this time I noticed that one artifact was not removed.

After switching to cargo:redeploy the error was solved.

妄想挽回 2024-12-15 12:20:50

使用 ant 部署任务部署到 tomcat 8 服务器时,我遇到了同样的错误消息。我的问题是服务器空间不足。检查 tomcat 的管理器日志让我发现:

10-Jul-2014 10:15:38.065 INFO [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: deploy: Deploying web application '/abc_beta'
10-Jul-2014 10:15:38.065 INFO [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: Uploading WAR file to /usr/share/apache-tomcat-8.0.9/webapps/abc_beta.war
10-Jul-2014 10:15:57.962 SEVERE [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: managerServlet.check[/abc_beta]
    java.io.IOException: No space left on device
    ... stacktrace ...

I ran into this same error message when deploying to a tomcat 8 server using the ant deploy task. The issue in my case was that I was running out of space on the server. Checking tomcat's manager log is what clued me in:

10-Jul-2014 10:15:38.065 INFO [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: deploy: Deploying web application '/abc_beta'
10-Jul-2014 10:15:38.065 INFO [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: Uploading WAR file to /usr/share/apache-tomcat-8.0.9/webapps/abc_beta.war
10-Jul-2014 10:15:57.962 SEVERE [http-nio-8080-exec-2] org.apache.catalina.core.ApplicationContext.log Manager: managerServlet.check[/abc_beta]
    java.io.IOException: No space left on device
    ... stacktrace ...
束缚m 2024-12-15 12:20:50

我不记得我是否或如何解决这个问题,但由于 rascio 有同样的问题,我会发布一个想法。也许这是需要 ssl 的旅行车扩展:

    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>2.2</version>
        </extension>
    </extensions>

尽管猜测。我认为在 Maven 3.0 之前你不需要它。

I don't remember if or how I solved this, but as rascio has the same problem, I'll post a an idea. Maybe it's the wagon-extension for ssl that's needed:

    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>2.2</version>
        </extension>
    </extensions>

Wild guess though. I think you didn't need it before Maven 3.0.

霞映澄塘 2024-12-15 12:20:50

我们周一突然偶然发现了此异常的另一个原因,当时使用 cargo 插件 插件在 Jenkins 实例上进行的部署作业停止工作。不是全部,而是一些。主要区别是 Nexus 作业中的自定义 settings.xml从中下载可部署项的存储库。

成功的部署作业的配置如 https:// /support.sonatype.com/entries/20943003-configure-maven-to-download-from-nexus,失败的缺少存储库并且pluginRepository

我仍然不确定为什么行为会在某一时刻发生变化。有什么建议吗?

Another reason for this exception that we stumbled upon suddenly on monday, when deployment jobs on our Jenkins instance using the cargo plugin plugin stopped working. Not all of them, but some. The main difference was a a custom settings.xml in the jobs for a Nexus repository to download deployables from.

The successful deployment jobs had it configured like described in https://support.sonatype.com/entries/20943003-configure-maven-to-download-from-nexus, the failed ones were missing the repository and pluginRepository

I'm still not sure why the behavior changed at one point. Any tipps?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文