Reputation: 291
Here this is my error when I am trying to run the web.xml
of my project in Eclipse.
This is the main error that I am facing when I am trying to run the web page of my project
***SEVERE: Error configuring application listener of `class` org.apache.catalina.deploy.ApplicationListener@1864160e
java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener****
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(`ClassLoader`.java:927)
at java.lang.ClassLoader.loadClass(ClassLoader.java:298)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1629)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Sep 10, 2013 6:37:24 PM org.apache.catalina.core.StandardContext listenerStart
Upvotes: 17
Views: 94599
Reputation: 280011
The servlet-api.jar
is not on your classpath. Check in your servlet container's lib
folder. If you are using Tomcat, that'll typically be in C:/apache-tomcat-7.XX/lib
. If it isn't there, download it and add it.
The Tomcat Servlet API jar is available here.
Upvotes: 6
Reputation: 468
You have missed some jars like struts-spring plugin
Use similar versions to get clear output
Upvotes: 5
Reputation: 37
If you have configured and built project properly with all required jars and still getting same error then you might missed to create classes folder. If we are using existing project setup and configuring it, then default output folder should be entered manually as per project requirement. In my case, eclipse was giving default output folder to /bin but it was configured to project_name/WEB-INF/classes. So I have changed it to project_name/WEB-INF/classes
Upvotes: 0
Reputation: 1764
(It worked in my case) This is also one of the case where it works, Go to Windows->ShowView->Servers. Expand Tomcat(for an e.g)-> delete the concerned jar Rebuild the project.
To this condition to work solution given by @Rishi Gautam should be true.
Upvotes: 0
Reputation: 13
I experienced a similar issue whenever I checked out my project fresh from the SVN repository and this worked for me:-
1) Clean the Server. TopBarMenu>Project>Clean
2) Disable Automatic Building. TopBarMenu>Project>Uncheck Build Automatically
3) Manually Build the Project. TopBarMenu>Project>Build
Alternatively, RightClick the Project you want to Build and click Build Project (above refresh). (Note: This option is hidden if projects are set to build automatically)
4) Run the project.
Upvotes: 1
Reputation: 2309
This would periodically happen with me. Even though the dependency was correct and even though I had previously started the server in Eclipse with no problems. However, if I would change code while the server was running, sometimes I would get this problem.
I would remove the application from the server. Start the server. Stop the server. Then, re-run 'mvn eclipse:eclipse -Dwtpversion=2.0" (probably similar to Project->Clean).
Then, hit F5 to Refresh the project. Add the application to the server. Start the server.
Sometimes changing code while the server is running or if it is stopped incorrectly, this also blocks the port (sometimes shutting down eclipse or restarting my computer is required).
Upvotes: 0
Reputation: 341
Remove your application from the server and re deploy your application again.
Upvotes: 1
Reputation: 2970
If you have imported someone else's project in Eclipse then remove and add servlet-api.jar
in classpath as the path of servlet-api.jar could be different on your system.
After that clean the project and run again.
Upvotes: 0
Reputation: 79
Check all the Jars are properly Configured or not. Clean the Eclipse server. Clean Tomcat Working Directory. Go to Menu Project -> Clean. Restart the server and Application.
Upvotes: 2
Reputation: 1938
1) Right-click on the project's then select "Properties".
2) select "Deployment Assembly"
3) Click the "Add button" on the right side.
4) Select "Java Build Path Entries" from the menu of Directive Type and then click on "Next" button.
5) And Select the "Maven Dependencies" from the Java Build Path Entries menu and click "Finish".
6) Delete the old server instance and create the new one then run the project on the server ...
Upvotes: 33
Reputation: 1
If you have deployed libraries for the javax.servlet
which is part of the JavaEE package then you have made a mistake, the web server already contains those libraries and loads corresponding to your servlet specification API.
Upvotes: 0