title: Jenkins auto deploying failed, when all settings are right. -- error in mapperLocations, Spring (illegalArgumentException, TomcatManagerException)
body: <p>I want to share some Jenkins auto-deployment issue solutions, that I could not find on the internet including here.<br/>
  But I'm almost a freshman in StackOverflow, so I'm just here to ask myself and answer myself right away.<br/>
  // I have tried to share the solution public on GitHub issue, I could not use it well, too.<br/>
  // asking to be excused...<br/>
  <hr/>
  I'm using Spring MVC 4.3.9, connected to CI/CD.
  // GitHub branch -> Jenkins -> TestServer (Tomcat 8.5)</p>
  
  <p>I allowed all the IP addresses, made and set the right Tomcat Manager account both in Jenkins credentials menu and tomcat.
  But the same error always occurs -- TomcatManagerException and also the illegal argument exception (in the full log from Jenkins by maven build option, -X -e, not sure). 
  // Same results, with both Deploy war plugin and SSH_publish plugin.</p>
  
  <p>Here is the Jenkins console output. (I don't think this one is the full log.)</p>
  
  <pre><code>[INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  7.895 s
  [INFO] Finished at: ~~~Time~~~
  [INFO] ------------------------------------------------------------------------
  [DeployPublisher][INFO] Attempting to deploy 1 war file(s)
  [DeployPublisher][INFO] Deploying ~~YourDIR&amp;WAR~~ to container Tomcat 8.x Remote with context ~~YourContextName~~
    Redeploying [ ~~YourDIR&amp;WAR~~]
    Undeploying  ~~YourDIR&amp;WAR~~]
    Deploying [ ~~YourDIR&amp;WAR~~]
  ERROR: Build step failed with exception
  org.codehaus.cargo.container.ContainerException: Failed to deploy [ ~~YourDIR&amp;WAR~~]
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:104)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:180)
      at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
      at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
      at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
      at hudson.FilePath.act(FilePath.java:1075)
      at hudson.FilePath.act(FilePath.java:1058)
      at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
      at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
      at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
      at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
      at hudson.model.Build$BuildExecution.post2(Build.java:186)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      at hudson.model.Run.execute(Run.java:1905)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
  Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The Tomcat Manager responded "FAIL - Deployed application at context path [~~YourContextName~~] but context failed to start
  " instead of the expected "OK" message
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:721)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:767)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:312)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:99)
      ... 19 more
  org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The Tomcat Manager responded "FAIL - Deployed application at context path [~~YourContextName~~] but context failed to start
  " instead of the expected "OK" message
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:721)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deployImpl(TomcatManager.java:767)
      at org.codehaus.cargo.container.tomcat.internal.TomcatManager.deploy(TomcatManager.java:312)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:99)
      at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:180)
      at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
      at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
      at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
      at hudson.FilePath.act(FilePath.java:1075)
      at hudson.FilePath.act(FilePath.java:1058)
      at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
      at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
      at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
      at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
      at hudson.model.Build$BuildExecution.post2(Build.java:186)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
      at hudson.model.Run.execute(Run.java:1905)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)
  Build step 'Deploy war/ear to a container' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p><br/>
  * I also got illegal argument exception in maven console, in mapperLocations setting.<br/>
  ===> This is the key</p>