I’m fairly new to the Spring framework. I have recently installed SpringSource Tool Suite (version 2.8.1.RELEASE). Using Subclipse, I have checked out a Spring MVC project that my team mate has created. It works fine on his machine, but we can’t figure out why a build error is happening on my machine.
I use Tomcat v6.0 Server to run the project. This is part of the error:
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
2012-jan-30 13:43:46 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:926)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
The Tomcat server has the following classpath: Bootstrap entries: JRSE System Library [jdk1.6.0_27], spring-2.5.2-20080220-410.jar. User entries: bootstrap.jar, tools.jar
Any ideas on how to fix this?
You need to go to your build path settings and make sure you have Apache Tomcat library included.
Right-click your project name from Project Explorer, click properties. In the properties dialog box, click Java Build Path from the list on left, then open libraries tab. Confirm if Apache Tomcat library is there.
If it is not there, click Add Library -> Server Runtime -> Apache Tomcat v x.0 -> Finish.