title: maven tomcat7 deployment Error 403
body: <p><em>Hello</em></p>
  
  <p>I know kind of this question was put into here several times already and I read many of the answers, unfortunately, nothing worked or me so far.</p>
  
  <p><strong>What am I using:</strong></p>
  
  <ul>
  <li>Windows7 </li>
  <li>Tomcat 7 </li>
  <li>Maven - plugin 'tomcat7-maven-plugin' </li>
  <li>Application has java in backend, frontend javascript</li>
  </ul>
  
  <p><strong>What is working so far:</strong>
  I can compile, build, ..., deploy the war manually and the webapp runs fine in localhost.</p>
  
  <p><strong>What I try now:</strong></p>
  
  <p>Build and automatically deploy the app with Maven.
  Via the tomcat-plugin I planned to deploy the generated war file automatically. I hope this thought is not already wrong; if so, please let me know.</p>
  
  <p>Ok let me list what I have set in the different files and what I have executed.</p>
  
  <p><strong>Settings.xml of maven:</strong></p>
  
  <pre><code>&lt;server&gt;
    &lt;id&gt;TomcatServer&lt;/id&gt;
    &lt;username&gt;testuser&lt;/username&gt;
    &lt;password&gt;testpw&lt;/password&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p><strong>tomcat-users.xml:</strong></p>
  
  <p>I decided to take all, so that no role can be missed and lead to a problem. I also tried with just using "manager-gui" and with "manager-gui and admin".</p>
  
  <pre><code>&lt;role rolename="manager-gui"/&gt;
    &lt;role rolename="manager-script"/&gt;
    &lt;role rolename="manager-jmx"/&gt;
    &lt;role rolename="manager-status"/&gt;
    &lt;role rolename="admin-gui"/&gt;
    &lt;role rolename="admin-script"/&gt;
    &lt;user username="testuser" password="passwd" roles="manager-gui, manager-script, manager-jmx, manager-status, admin-gui, admin-script"/&gt;
  </code></pre>
  
  <p><strong>pom.xml:</strong></p>
  
  <pre><code>...
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.mr&lt;/groupId&gt;
  &lt;artifactId&gt;myWebapp&lt;/artifactId&gt;
  &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;name&gt;my Web App&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  &lt;dependencies&gt;
  
   ...
  &lt;plugins&gt;
          &lt;plugin&gt;
               &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
               &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
               &lt;version&gt;2.0&lt;/version&gt;
               &lt;configuration&gt;
                   &lt;url&gt;http://LuklHost:port/manager&lt;/url&gt;
                   &lt;server&gt;TomcatServer&lt;/server&gt;
                   &lt;username&gt;testuser&lt;/username&gt;
                   &lt;password&gt;passwd&lt;/password&gt;
                   &lt;path&gt;/myWebapp&lt;/path&gt;
               &lt;/configuration&gt;
           &lt;/plugin&gt;
  &lt;/plugins&gt;
  </code></pre>
  
  <p><strong>Step to deploy:</strong></p>
  
  <p>In powershell (opened with admin-rights)</p>
  
  <p>mvn tomcat:deploy</p>
  
  <p><em>leads to following 403 error-message:</em>
  (localhost needed to be "deleted")</p>
  
  <pre><code>    [INFO] Deploying war to http://localhost:8080/TripleDictionary
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 6.821s
  [INFO] Finished at: Sat Apr 12 13:59:37 CEST 2014
  [INFO] Final Memory: 18M/223M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project TripleDictionary: Ca
  nnot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2FTri
  pleDictionary&amp;war= -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:depl
  oy (default-cli) on project TripleDictionary: Cannot invoke Tomcat manager
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
          at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
          at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:601)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
  Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager
          at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:149)
          at org.codehaus.mojo.tomcat.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:70)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
          ... 19 more
  Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2
  FTripleDictionary&amp;war=
          at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
          at org.codehaus.mojo.tomcat.TomcatManager.invoke(TomcatManager.java:604)
          at org.codehaus.mojo.tomcat.TomcatManager.deployImpl(TomcatManager.java:662)
          at org.codehaus.mojo.tomcat.TomcatManager.deploy(TomcatManager.java:295)
          at org.codehaus.mojo.tomcat.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85)
          at org.codehaus.mojo.tomcat.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:85)
          at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141)
          ... 22 more
  [ERROR]
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR]
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>Why do I get this error? And of course how can I fix it?</p>
  
  <p>Actually I really cannot put it exact, because I think I kind of checked everything, even what folder has which rights.</p>
  
  <p>Hope for ideas and help.</p>
  
  <p><em>Thanks in advance,
  Meru</em></p>