0

So this is Kind of a follow on to this question, I was able to deploy a basic Spring MVC app by right clicking on the project in eclipse and exporting the war file to the Web app directly, but how do I set it up so that I can select "Run on Server" or "Debug on Server" in eclipse?

Currently in eclipse I get the Error WARNING: No mapping found for HTTP request with URI [/SpringMVC/] in DispatcherServlet with name 'mvc-dispatcher' when I try to run on Server

I am using Tomcat 6 and Eclipse 3.7 ( and Maven 3.0.4 in case that is relevant ).

If there is any further information required please let me know.

<web-app id="WebApp_ID" version="2.4"
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">

<display-name>Spring Web MVC Application</display-name>

<servlet>
    <servlet-name>mvc-dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>mvc-dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>

Pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mkyong.common</groupId>
    <artifactId>SpringMVC</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>SpringMVC Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <properties>
        <spring.version>3.0.5.RELEASE</spring.version>
    </properties>

    <dependencies>

        <!-- Spring 3 dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>SpringMVC</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
Community
  • 1
  • 1
jonnie
  • 12,260
  • 16
  • 54
  • 91
  • What is your web.xml ? – AllTooSir May 01 '13 at 08:32
  • To set up "Run on server" , right click the server added in your Eclipse and add the project to it! – AllTooSir May 01 '13 at 08:33
  • @NoobUnChained web.xml is included and I have set up the server and added the project to it already, but I get a mapping issue as mentioned above – jonnie May 01 '13 at 12:58
  • Let us see the mapping in web.xml . – AllTooSir May 01 '13 at 14:54
  • @NoobUnchained I have included the Web.xml above but If you need more info , my servlet, controller, etc can be seen in my previous question [here](http://stackoverflow.com/questions/16299066/spring-application-not-mapping-in-tomcat) – jonnie May 01 '13 at 15:22
  • What URL did you try ? – AllTooSir May 01 '13 at 15:24
  • i can't see your `pom.xml`. Is the packaging set as `war` like this: `war`? – lunr May 01 '13 at 22:19
  • @lunr I have got `war` in my pom, i've included my Pom.xml file in the above. @NoobUnchained I used http://localhost:8081/SpringMVC/welcome (I have another service running on 8080 hence the 8081) – jonnie May 02 '13 at 12:34
  • Then there must be a problem with your `mvc-dispatcher-servlet.xml` or controller class. – lunr May 05 '13 at 12:51

0 Answers0