Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to deploy to Tomcat7 from cargo

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.

like image 783
Viktor Hedefalk Avatar asked Oct 06 '11 13:10

Viktor Hedefalk


1 Answers

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.

like image 115
cringe Avatar answered Oct 12 '22 10:10

cringe