PDA

View Full Version : DispatcherServlet problem


sim085
Apr 25th, 2006, 07:18 PM
Hi,

I do not know how best to explain this, however I will give it a go. I am trying to build my first spring application. I am starting from the web layer and then I hope I do the bussiness and data access layers as well.

However I have a small problem. When I am running my application (on tomcat) I have a ClassNotFoundException that it could not find the org.springframework.web.servlet.DispatcherServlet. Now I am sure that all the spring libreries are in place.

What I have is the web.xml under the WEB-INF folder and also the app-servlet.xml. My web.xml file (where the problem seems to be) is as follows:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'
'http://java.sun.com/dtd/web-app_2_3.dtd'>

<web-app>

<servlet>
<servlet-name>app</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-start-up>1</load-on-start-up>
</servlet>

<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

</web-app>


I have checked on the online Spring MVC Step by Step and also on a book I have and the Web.xml file is writen in that way as well.

Also something else is that when I press the refresh button the exception goes away, and instead the web page says Servlet app is not available, The requested resource (Servlet appis not available) is not available.

Please ask me for any further information required, and thanks for any support!

regards,
sim085

igotmilk
Apr 25th, 2006, 08:15 PM
I think the error is pretty straight forward. The JVM can't find org.springframework.web.servlet.DispatcherServlet. Make sure that the jars are added to your classpath/manifest.

sim085
Apr 26th, 2006, 03:44 AM
Hey, thanks for your answer :) I am sorry, I checked all the libreries I had in my war file, and forgot that I had to set the libreries of tomcat as well!! Now I have other problems :) but at least the Despather is found :)

thanks,
sim085