Announcement Announcement Module
Collapse
No announcement yet.
DispatcherServlet not found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DispatcherServlet not found

    Okay, I've spent two days grinding away at this. None of the solutions have worked for me so far.

    I am running SpringSource Tool Suite 2.3.0 and trying to write a very simple Spring MVC sample app. I have Spring 3.0 loaded. I have ALL of the libs in my WEB-INF\lib folder for the project, though I know that is overkill, but I am desperate.

    My web.xml looks like this:
    Code:
     <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
      <servlet>
      	<servlet-name>Spring2</servlet-name>
      	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      	<load-on-startup>1</load-on-startup>	
      </servlet>
      
      <servlet-mapping>
      	<servlet-name>Spring2</servlet-name>
      	<url-pattern>*.htm</url-pattern>
      </servlet-mapping>
      
      <display-name>Spring2</display-name>
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    And my Spring2-servlet.xml looks like this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
    <bean name="/hello.htm" class="org.aero.tcs.add.spring2.HelloController"/>
    </beans>
    With the HelloController:
    Code:
    package org.aero.tcs.add.spring2;
    
    import java.io.IOException;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.mvc.Controller;
    
    public class HelloController implements Controller {
    	protected final Log logger = LogFactory.getLog(getClass());
    	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) 
    	throws ServletException, IOException {
    		logger.info("returning hello view");
    		return new ModelAndView("hello.jsp");
    	}
    	
    }
    exception details:
    Jan 6, 2010 8:07:39 AM org.apache.catalina.core.ApplicationContext log
    SEVERE: Error loading WebappClassLoader
    delegate: false
    repositories:
    /WEB-INF/classes/
    ----------> Parent Classloader:
    [email protected] 753
    org.springframework.web.servlet.DispatcherServlet
    java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

    Please somebody help me figure out why DispatcherServlet or WebappClassLoader cannot be found.

    Thank you,
    Ginni
    Last edited by [email protected]; Jan 6th, 2010, 10:09 AM.

  • #2
    Disregard

    I had added WEB-INF/lib to the Sources in the Build Path of the project and once I removed that, the error went away.

    Comment

    Working...
    X