title: Maven Tomcat Embedded
body: <p>I am trying to run a Spring webapp using maven with the</p>
  
  <pre><code>mvn tomcat:run
  </code></pre>
  
  <p>command, but whenever I navigate to <code>http://localhost:8080/myApp</code>, I get the error: "The requested resource () is not available". Nothing shows up in the logs. I think my app is supposed to be deployed to "/" instead of "/myApp". Is there a way to do this?</p>
  
  <p>Maven output log:</p>
  
  <pre><code>[INFO] Scanning for projects...
  [INFO] Searching repository for plugin with prefix: 'tomcat'.
  [INFO] ------------------------------------------------------------------------
  [INFO] Building myApp
  [INFO]    task-segment: [tomcat:run]
  [INFO] ------------------------------------------------------------------------
  [INFO] Preparing tomcat:run
  [INFO] [resources:resources {execution: default-resources}]
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] Copying 4 resources
  Downloading: http://svn.asdf.com:8081/artifactory/repo/org/postgresql/postgresql/8.3/postgresql-8.3.pom
  [INFO] Unable to find resource 'org.postgresql:postgresql:pom:8.3' in repository central (http://repo1.maven.org/maven2)
  Downloading: http://svn.asdf.com:8081/artifactory/repo/java-memcached/java-memcached/1.6/java-memcached-1.6.pom
  [INFO] Unable to find resource 'java-memcached:java-memcached:pom:1.6' in repository central (http://repo1.maven.org/maven2)
  [INFO] [compiler:compile {execution: default-compile}]
  [INFO] Nothing to compile - all classes are up to date
  [INFO] [tomcat:run {execution: default-cli}]
  [INFO] Running war on http://localhost:8080/myApp
  [INFO] Using existing Tomcat server configuration at C:\cygwin\home\workspace\myApp\target\tomcat
  Sep 4, 2009 3:17:29 PM org.apache.catalina.startup.Embedded start
  INFO: Starting tomcat server
  Sep 4, 2009 3:17:29 PM org.apache.catalina.core.StandardEngine start
  INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
  Sep 4, 2009 3:17:30 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring root WebApplicationContext
  log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
  log4j:WARN Please initialize the log4j system properly.
  Sep 4, 2009 3:17:31 PM org.apache.catalina.core.ApplicationContext log
  INFO: Initializing Spring FrameworkServlet 'myApp'
  Sep 4, 2009 3:17:31 PM org.apache.coyote.http11.Http11Protocol init
  INFO: Initializing Coyote HTTP/1.1 on http-8080
  Sep 4, 2009 3:17:31 PM org.apache.coyote.http11.Http11Protocol start
  INFO: Starting Coyote HTTP/1.1 on http-8080
  </code></pre>
  
  <p>Web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  
  &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
           version="2.4"&gt;
  
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
                  /WEB-INF/applicationContext.xml
          &lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;context&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.context.ContextLoaderServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;myApp&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;3&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;myApp&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
  &lt;/web-app&gt;
  </code></pre>