I have created war and trying to deploy to local tomcat.When i am running gradle cargoRunLocal .
Command prompt displaying message
Building 0% : cargoLocalRun
I checked video and blog , i am following steps as per instruction.My script is like below.My war is already available. Neither War is not copied to tomcat not tomcat started.
I am using jdk 1.7, gradle 2.8
cargo {
containerId = 'tomcat7x’
port = 8080
println(“start”)
deployable {
context = 'userregisteration’
file = file(‘C:/Users/naresh.vatsal/workspace_spring_jan14/userregisteration/build/libs/userregisteration.war’)
Now i changed my script ,after running gradle cragoLocalRun getting below error
FAILURE: Build failed with an exception.
What went wrong:
Could not read entry ‘:cargoRunLocal’ from cache taskArtifacts.bin (C:\Users\naresh.vatsal\workspace_spring_jan14\userregisteration.gradle\2.8\taskArtifacts\ta
skArtifacts.bin).
com.bmuschko.gradle.cargo.convention.ZipUrlInstaller; local class incompatible: stream classdesc serialVersionUID = -1368481122336730923, local class serialVe
rsionUID = 5549252188911634944
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Thanks Benjamin,
i tried to upload code to github, but not able to complete.
So i have uploaded the code to google drive.
Please find link for downloading
The container starts up properly for me (executed with gradle cargoRunLocal -i):
:cargoRunLocal
Executing task ':cargoRunLocal' (up-to-date check took 0.005 secs) due to:
Task.upToDateWhen is false.
Deployable artifacts = [/Users/bmuschko/Downloads/userregisteration/build/libs/userregisteration.war]
Starting action 'run' for local container 'tomcat7x'
Container properties = [cargo.tomcat.ajp.port:9099]
System properties = [:]
Tomcat 7.x starting...
Deploying [/Users/bmuschko/Downloads/userregisteration/build/libs/userregisteration.war] to [/var/folders/wg/5w1qdscj105fzvs23ypkc2ym0000gn/T/cargo/conf/webapps]...
Tomcat 7.x started on port [8080]
[ant:cargo] Press Ctrl-C to stop the container...
Press Ctrl-C to stop the container...
I wasn’t sure what URL to hit that should actually serve up some content but Tomcat is running. What’s a valid URL that should work (please verify without Cargo first that it actually does work)?
Some things to keep in mind when using Cargo:
Cargo does not copy the WAR file to the webapps directory of Tomcat. So if you are looking for it there you won’t find it.
Cargo does not write the logs to the default Tomcat logs directory.
Hi Benjamin
You have copied war file manually to tomcat or cargo copied for build/lib folder to tomcat.
i changed deployable path from
file = file(‘D:/userregisteration/build/libs/userregisteration.war’)
to
file = file(’/userregisteration/build/libs/userregisteration.war’)
suggest how file path should be given with drive name or starting with / e.g C:/user/userreg.war or /user/userreg.war
i am getting below error
What went wrong:
Execution failed for task ‘:cargoRunLocal’.
Deployable D:\userregisteration\userregisteration\build\libs\userregisteration
.war does not exist
Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to
get more log output.
Cargo does all the work for you. I did not copy it manually. As described in the documentation of the plugin, Cargo automatically determines the path to the WAR file. You don’t have to the value manually. Just remove the assignment from your configuration.
file: An arbitrary artifact or exploded WAR directory to be deployed to container (defaults to project/module artifact - WAR or EAR file).
Thanks Benjamin for your support, now i am able to deploy and run web app.
I need to keep tomcat in project directory then only my web app deploy.
Is it possible to keep tomcat outside project directory and provide same path in homDir. Please advise on this.