Hi, I am trying to deploy my web appplication to tomcat 8.5.
Here goes my build file.
plugins {
id "com.bmuschko.cargo" version "2.2.3"
id 'nu.studer.credentials' version '1.0.1'
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'war'
group = 'com.nautilus'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenLocal()
jcenter()
}
dependencies {
}
cargo {
containerId = 'tomcat8x'
port = 8080
remote {
hostname = 'localhost'
username = project.credentials.("manager.username")
password = project.credentials.("manager.password")
}
deployable {
file = file('build/libs/my.war')
context = 'my-context'
}
}
I am try to run next commands gradle war cargoDeployRemote gradle war cargoRedeployRemote
but I am getting the next error
:cargoDeployRemote (Thread[Task worker,5,main]) completed. Took 1.825 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':cargoDeployRemote'.
> org.codehaus.cargo.container.ContainerException: Failed to deploy [E:\programming-projects\java\nautilus\nautilus-app\build\libs\my.war]
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':cargoDeployRemote'.
...
Caused by: : org.codehaus.cargo.container.ContainerException: Failed to deploy '
...
Caused by: org.codehaus.cargo.container.ContainerException: Failed to deploy ..
...
Caused by: java.net.SocketException: Software caused connection abort: recv failed
P.S. I know that for localhost there are local configuration but in future it will be replaced with a real host.
I see nothing wrong with the configuration in your build script. The issue you are seeing is likely happen due to some network misconfiguration or a firewall blockage. Try to shut down your firewall and see if it works. Also make sure you create the manager user and role in Tomcat.
If that didn’t help then I’d suggest asking on the Cargo forum. The Gradle plugin is just configuring the Cargo Ant task under the covers. The actual failure comes from a Cargo class (see stack trace you provided). You might want to run with -s to potential get more information.
RE: credentials the following should be good enough:
Caused by: org.codehaus.cargo.container.ContainerException: Failed to redeploy [
D:\apps\apache-tomee-plus-1.6.0.1\webapps\enovia.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDep
loyer.redeploy(AbstractTomcatManagerDeployer.java:188)
at org.codehaus.cargo.ant.CargoTask.executeActions(CargoTask.java:794)
at org.codehaus.cargo.ant.CargoTask.execute(CargoTask.java:572)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
… 125 more
Caused by: java.net.ConnectException: Connection refused: connect
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(Tom
catManager.java:567)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(Tomca
tManager.java:882)
at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(
TomcatManager.java:895)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDep
loyer.redeploy(AbstractTomcatManagerDeployer.java:169)
… 129 more