Cargo hangs while starting GlassFish 4.x and uses up 100% CPU - maven

Trying to go with Maven Cargo plugin instead of the Maven GlassFish plugin that doesn't support hot redeploy. Cargo hangs on goals start/run for GlassFish local existing installation and eats up to 100% CPU until I kill it! I tried with a plain text password and then created a password file, same result. Online searching turns up posts with various kinds of Cargo-GlassFish configuration, almost all of them older than the versions I'm using, and didn't help either.
Maven plugin config and debug log are attached. Any help is appreciated.
Environment: Mac OS X Mavericks, Oracle JDK 1.7.0_45, GlassFish-4.0-b89, Maven 3.1.1, cargo-maven2-plugin 1.4.5
Maven plugin config
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.5</version>
<configuration>
<container>
<containerId>glassfish4x</containerId>
<type>installed</type>
<output>${glassfish.installDirectory}/glassfish/domains/${glassfish.domainName}/logs/server.log</output>
<!-- Fail if not started/stopped within 30 sec -->
<timeout>30000</timeout>
</container>
<configuration>
<type>existing</type>
<home>${glassfish.installDirectory}/glassfish</home>
<properties>
<cargo.glassfish.domain.name>${glassfish.domainName}</cargo.glassfish.domain.name>
<cargo.remote.username>${glassfish.adminUser}</cargo.remote.username>
<cargo.remote.passwordFile>${glassfish.installDirectory}/admin.password</cargo.remote.passwordFile>
<!-- Maven sets java.home property to JRE but we want JDK -->
</properties>
</configuration>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>${project.packaging}</type>
<properties>
<context>/${project.artifactId}</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
Debug log
[DEBUG] [2.ContainerStartMojo] Resolved artifact and dependencies:file:/Users/Abhijit/Repositories/maven/org/codehaus/cargo/cargo-core-container-glassfish/1.4.5/cargo-core-container-glassfish-1.4.5.jar]
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-glassfish:jar:1.4.5 for container glassfish4x
[DEBUG] Scheduling deployable for deployment: [groupId [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId [calculator-enc], type [war], location [null], pingURL [null]]
[DEBUG] Initial deployable values: groupId = [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId = [calculator-enc], type = [war], location = [null]
[DEBUG] Searching for an artifact that matches [name.abhijitsarkar.learning.webservices.jaxws.security:calculator-enc:war:null]...
[DEBUG] Checking artifact [name.abhijitsarkar.learning.webservices.jaxws.security:calculator-enc:war:null]...
[DEBUG] Computed deployable values: groupId = [name.abhijitsarkar.learning.webservices.jaxws.security], artifactId = [calculator-enc], classifier = [null], type = [war], location = [/Users/Abhijit/Repositories/git/java-ee/jaxws-security/calculator-enc/target/calculator-enc-0.0.1-SNAPSHOT.war]
[DEBUG] Setting deployable property [context]:[/calculator-enc] for [/Users/Abhijit/Repositories/git/java-ee/jaxws-security/calculator-enc/target/calculator-enc-0.0.1-SNAPSHOT.war]
[DEBUG] Invoking setter method public synchronized void org.codehaus.cargo.container.deployable.WAR.setContext(java.lang.String) for deployable org.codehaus.cargo.container.deployable.WAR[calculator-enc-0.0.1-SNAPSHOT.war] with argument /calculator-enc
[DEBUG] Setting container timeout to [30000]

For others who may come across this issue, it took me 2 days of debugging through Cargo src code to figure out the problem. The two <home> locations are actually both needed. The one under <container> should point to the GlassFish outer installation directory (that contains another glassfish directory inside) and the one under <configuration> should point to the glassfish/domains directory.
Has anyone ever mentioned to them that the naming convention is terrible? Why not call the later '<home>' <domainsDir> or something that actually means what it reads?

Related

Retrieving external .proto files for protoc with protobuf-maven-plugin

Context: My team is working on making our suite of Java services containerized and dynamically scalable. To accomplish this, our plan is to use Envoy backed by etcd, with a custom-build Endpoint Discovery Service as described in the Envoy documentation, using the v2 gRPC-based API. We'll then generate Docker images for each service and deploy/manage them with Kubernetes.
We use Maven as a build system. I'm pretty well versed in Maven, but this is my first time with gRPC or protocol buffers.
I've created a stub for my service using Spring Boot, with Jetty offering some REST and JMX endpoints for management. Before introducing the protobuf stuff, the stub built and ran just fine.
I've downloaded the Envoy data-plane-api and checked the API definition files (**/*.proto) into my project under src/main/proto, keeping the directory structure from the download (e.g. src/main/proto/envoy/api/v2/eds.proto). (Side question: do I need the BUILD files?)
In the end, I'd like a standalone Maven build that can read these files and generate Java classes. The build needs to work on Windows and OS X boxes so that it works for developers, and on Linux boxes so that it works in our CI (Bamboo). It should require nothing more than a JDK, a Maven install, and a Maven repo. (We have an Artifactory instance where I can upload artifacts not otherwise available online, if necessary.)
What I have so far seems like it will accomplish my portability goals:
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>discovery-service</artifactId>
<packaging>jar</packaging>
<name>Discovery Service</name>
<version>1.0.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
<checkStaleness>true</checkStaleness>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<!-- provides os.detected.classifier (i.e. linux-x86_64, osx-x86_64) property -->
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.4.1.Final</version>
</extension>
</extensions>
</build>
<dependencies>
<dependency>
<groupId>io.hydrosphere</groupId>
<artifactId>envoy-data-plane-api_2.11</artifactId>
<version>v1.5.0_1</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.9.1</version>
</dependency>
<!--Unrelated deps (Spring Boot, Jetty, logging, etc) omitted for brevity -->
</dependencies>
</project>
When I build this project using mvn compile, Maven correctly downloads protoc and invokes it, but protoc errors because it can't find some external dependencies:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: osx
[INFO] os.detected.arch: x86_64
[INFO] os.detected.classifier: osx-x86_64
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Discovery Service 1.0.0
[INFO] ------------------------------------------------------------------------
Downloading: http://devutl1.sircon.com:8081/artifactory/libs-snapshot/org/glassfish/javax.el/maven-metadata.xml
Downloading: http://devutl1.sircon.com:8081/artifactory/libs-release/org/glassfish/javax.el/maven-metadata.xml
Downloaded: http://devutl1.sircon.com:8081/artifactory/libs-release/org/glassfish/javax.el/maven-metadata.xml (882 B at 547 B/s)
Downloaded: http://devutl1.sircon.com:8081/artifactory/libs-snapshot/org/glassfish/javax.el/maven-metadata.xml (882 B at 547 B/s)
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (default-cli) # discovery-service ---
[INFO]
[INFO] --- protobuf-maven-plugin:0.5.1:compile (default) # discovery-service ---
[INFO] Compiling 56 proto file(s) to /Users/jrobb/Projects/vertabrae/trunk/scaling/discovery-service/target/generated-sources/protobuf/java
[ERROR] PROTOC FAILED: validate/validate.proto: File not found.
gogoproto/gogo.proto: File not found.
envoy/api/v2/core/address.proto: Import "validate/validate.proto" was not found or had errors.
envoy/api/v2/core/address.proto: Import "gogoproto/gogo.proto" was not found or had errors.
envoy/config/metrics/v2/stats.proto: Import "envoy/api/v2/core/address.proto" was not found or had errors.
envoy/config/metrics/v2/stats.proto: Import "validate/validate.proto" was not found or had errors.
envoy/config/metrics/v2/stats.proto:148:5: "envoy.api.v2.core.Address" is not defined.
envoy/config/metrics/v2/stats.proto:167:5: "envoy.api.v2.core.Address" is not defined.
The output continues, with the same set of errors for each .proto file.
It seems that the crux of the issue is that I don't have validate/validate.proto or gogoproto/gogo.proto, which are imported at the top of (nearly?) every .proto file:
import "google/protobuf/wrappers.proto";
import "validate/validate.proto";
import "gogoproto/gogo.proto";
It seems to be finding wrappers.proto, which I think is coming from my compile-time Maven dependency on protobuf-java.
I think gogoproto/gogo.proto might be looking for this: https://github.com/gogo/protobuf/blob/master/gogoproto/gogo.proto
I'm totally stumped about where validate/validate.proto is supposed to come from. I've seen some evidence that it's specific to Envoy, but I can't find it.
I've spent the last few hours searching, and I'm coming up empty on anyone who's done this before. Where do I get those files? If I can't get them from Maven Central, I'll build them myself and upload to Artifactory.
My eyes are glazing over looking at documentation intended for people using other tech stacks, and I'm having trouble translating for my needs. Any and all help will be much appreciated, and I apologize if this is a hugely n00bish question. :)
Once again, the mere act of asking on SO has led me to the answer; found while adding context and detail to my question. There's a brand-new Java port of the Go-based Envoy control-plane: java-control-plane!
Somebody who, like me, would prefer to just depend on something from Maven Central, and already knew what they were looking for reported this issue, and while I was writing up this question, the maintainer answered: exactly that is coming soon!
I'm pleased to find that api/pom.xml in java-control-plane looks very similar to what I posted in my question. :)
So, if you find yourself in my situation, wanting to implement a Discovery Service for Envoy on a Java tech stack, java-control-plane is already there -- you just have to extend it with whatever backing store you want to use. I assume that, over time, implementations for that will pop up in the community as well. I'll be writing one for etcd and might end up contributing it back to the community.
Answering the finer details of my question:
Where do I get the two .proto file dependencies not included in data-plane-api?
They are in the java-control-plane source: they're checked in as part of the api module's source code, and therefore presumably not available as a separate dependency. I'm reasonably confident that the gogo.proto I found was the right one, but I'm still unclear on where I could have found validate.proto.
Do I need to include the BUILD files from data-plane-api in order to compile the *.proto files with protoc?
Nope! The api module in java-control-plane doesn't include them.

What Build Module in IntelliJ actually does for maven module

When I run
mvn clean install
for my maven module then it compiles fine. No issues.
But when I open my pom.xml file in IntelliJ and I choose to Build -> Build module then I get following issues:
Information:javac 1.8.0_144 was used to compile java sources
Information:Module "mymodule" was fully rebuilt due to project configuration/dependencies changes
Information:09.10.2017 21:16 - Compilation completed with 3 errors and 3 warnings in 23s 991ms
C:\somepath\mymodule\pom.xml
Error:Error:osgi: [mymodule] Exception: java.lang.ClassNotFoundException: org.apache.sling.bnd.models.ModelsScannerPlugin not found, parent: java.net.URLClassLoader#29453f44 urls:[] exception:java.lang.ClassNotFoundException: org.apache.sling.bnd.models.ModelsScannerPlugin
Error:Error:osgi: [mymodule] Failed to load plugin org.apache.sling.bnd.models.ModelsScannerPlugin;generatePackagesHeader=true, error: java.lang.ClassNotFoundException: org.apache.sling.bnd.models.ModelsScannerPlugin not found, parent: java.net.URLClassLoader#29453f44 urls:[] exception:java.lang.ClassNotFoundException: org.apache.sling.bnd.models.ModelsScannerPlugin
Error:Error:osgi: [mymodule] Cannot load the plugin org.apache.sling.bnd.models.ModelsScannerPlugin
This is a module with AEM code and it uses maven-sling-plugin. It works fine for other developers in the project. Because it's working when executed directly from maven I'm trying to understand what IntelliJ does in the background. But actually, my problem is those compilation issues.
From what I've found IntelliJ does not call maven when Build is done. Any ideas how can I find differences between running from IntelliJ and directly from Maven?
What happens here is that the ModelScanner plugin can't be found using the current ClassLoader. The reason for this can be that you are using IntelliJ IDEA Ultimate which comes with a OSGI plugin already pre-installed called 'Osmorc'. If this OSGI plugin is active it will determine the classloader to be used for building OSGI related projects.
So simply de-activating this Osmorc plugin in IntelliJ should allow your build to revert to the classloader from the ModelScannerPlugin mentioned in the configuration of your the maven-bundle-plugin in your projects POM.xml file which should solve the problem.
If this still results in a similar Maven build error, then make sure to add a Maven dependency 'org.apache.sling.bnd.model' to your maven-bundle-plugin in your POM.xml file.
<!-- Apache Felix Bundle Plugin -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<inherited>true</inherited>
<extensions>true</extensions>
<executions>
<!-- Configure extra execution of 'manifest' in process-classes phase to make sure SCR metadata is generated before unit test runs -->
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
</configuration>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<instructions>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
<_plugin>org.apache.sling.bnd.models.ModelsScannerPlugin;generatePackagesHeader=true</_plugin>
</instructions>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.bnd.models</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
could you please check your core pom file. it should contain a plugin section like this:
<plugin> <!-- Enable registration of Sling Models classes via bnd plugin --> org.apache.sling.bnd.models.ModelsScannerPlugin, <!-- Allow the processing of SCR annotations via a bnd plugin --> org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin;destdir=${project.build.outputDirectory} </plugin>
but if you created a project using aem archetype the tag looks like' <_plugin>

Howto use Maven Cargo Plugin to deploy a Web Application Bundle (WAB, OSGI + JavaEE) into Glassfish 3.x

I'm trying to use the Maven Cargo Plugin to deploy a set of OSGI bundles and an hybrid application .war (Webapplication with Restservice which uses OSGI) also called a Web Application Bundle (or WAB) (e.g. see https://glassfish.java.net/public/GF-OSGi-Features.pdf).
Deploying of OSGI bundles into a Glassfish 3.1.x works fine, but I haven't found a way to deploy the Web Application Bundle.
It's packaging is "war", but I have to deploy it as OSGI bundle. So how can I tell this the Cargo Plugin?
The maven configuration I tried to use:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<wait>false</wait>
<container>
<containerId>glassfish3x</containerId>
<home>${glassfish.home}</home>
<type>installed</type>
</container>
<configuration>
<type>existing</type>
<home>${glassfish.home}</home>
<properties>
<cargo.hostname>localhost</cargo.hostname>
<cargo.rmi.port>4848</cargo.rmi.port>
<cargo.domain.name>${glassfish.domain}</cargo.domain.name>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>com.acme.rest</groupId>
<artifactId>rest-api</artifactId>
<type>bundle</type>
</deployable>
</deployables>
</configuration>
</plugin>
But the following error shows up:
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:redeploy (default-cli) on project rest-api: Artifact [com.acme.rest:rest-api:bundle] is not a dependency of the project. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.0:redeploy (default-cli) on project rest-api: Artifact [com.acme.rest:rest-api:bundle] is not a dependency of the project.
Deploying as component type "web" works, but then I can't use the OSGI bundles...
Does anybody have experience with deploying Web Application Bundle and OSGI bundles?
I don't know about cargo plugin, but to deploy a wab using asadmin client, one has to pass a --type=osgi option as shown below:
asadmin deploy --type=osgi foo.war
So, see if you can configure cargo plugin to pass this option.
Sahoo
The trick is :
<deployable>
<groupId>com.acme.rest</groupId>
<artifactId>rest-api</artifactId>
<type>war</type>
<implementation>org.codehaus.cargo.container.deployable.Bundle</implementation>
</deployable>
You still have a WAR artifact, but Bundle will trick Cargo to deploy it as OSGi.
Try using version 1.4.7 which added support for sending asadmin params in conjunction with the param that #Sahoo mentioned.
<cargo.glassfish.deploy.arg.1>--type=osgi foo.war</cargo.glassfish.deploy.arg.1>
Allow passing extra parameters for glassfish deployment
https://jira.codehaus.org/browse/CARGO-1245

Could not connect to remote://localhost:9999. The connection timed out Jboss 7.1.1 Final

I am deploying builds to local and remote Jboss AS 7.1.1 Final at port 9999. Maven uses jboss plugin 'jboss-as-maven-plugin:7.1.1.Final' to manage builds to servers. I have confirmed that server is up and running and port is accessible at 9999. But "many times" build fails with following error for both local and remote Jboss. Jboss ic configured in Standalone mode single node cluster.
Stranglely build doesn't fail every time but most of the time. Not sure if we need to upgrade Maven plugin to higher version.
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with
exception(s) [INFO] o.h.m.e.h.MavenExecutionResultHandler - [1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal
org.jboss.as.plugins:jboss-as-maven-plugin:7.1.1.Final:undeploy
(default-cli) on project Test: Error executing UNDEPLOY [DEBUG]
Closing connection to remote [ERROR] Failed to execute goal
org.jboss.as.plugins:jboss-as-maven-plugin:7.1.1.Final:undeploy
(default-cli) on project Test: Error executing UNDEPLOY:
java.net.ConnectException: JBAS012144: Could not connect to
remote://localhost:9999. The connection timed out -> [Help 1]
UPDATE
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.1.Final</version>
<configuration>
<filename>${project.build.finalName}.jar</filename>
<username>${userName}</username>
<password>${password}</password>
</configuration>
</plugin>
I am now using latest version of Maven plug-in but it seems that connection timeout error is more frequent now. I am starting to think if Jboss behaves differently when trying to make too many remote deployment with different sub projects of the application. I am having 21 sub projects being deployed from a master POM. Sample configuration is as follows
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.master</groupId>
<artifactId>master</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<name>Master</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
<module>module4</module>
<module>module5</module>
<module>module6</module>
<module>module7</module>
<module>module8</module>
<module>module9</module>
<module>module10</module>
<module>module11</module>
<module>module12</module>
<module>module13</module>
</modules>
First, check plugin configuration.
For example:
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.9.Final</version>
<inherited>true</inherited>
<configuration>
<hostname>${jboss.hostname}</hostname>
<port>${jboss.port}</port>
<username>${jboss.user}</username>
<password>${jboss.pass}</password>
<timeout>30000</timeout>
</configuration>
</plugin>
If hostname, port number(default 9999), username and password are ok, you can try increasing "timeout" (default is 5000ms, you can try with 30000ms).
It worked for me.
4 Possible Solutions to Question
Remove your Local Cache settings which will be your local m2 repo Or Point to new m2 repo from your maven settings.xml file.
Try to connect to your local nexus/archiva (if any other) using relevant/appropriate credentials.It is only your Maven Plugin causing this problem.
Try to use the latest JBoss Deploy Plugin available in this link.
Alternatively check your windows/Linux firewall settings have been enabled or it.

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.
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.
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 ...
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.
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?

Resources