Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error : javax servlet ServletException

 
dale con
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I'm trying to call a simple servlet from an html page and get this error from tomcat. Can anyone tell me how to solve it

Many Thanks



exception

javax.servlet.ServletException: Wrapper cannot find servlet class simple.servlet.SimpleServlet2 or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:534)


root cause

java.lang.ClassNotFoundException: simple.servlet.SimpleServlet2
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:534)



this is my web.xml file


<?xml version="1.0" encoding="UTF-8"?>
<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>SimpleTest</display-name>
<servlet>
<description/>
<display-name>SimpleServlet2</display-name>
<servlet-name>SimpleServlet2</servlet-name>
<servlet-class>simple.servlet.SimpleServlet2</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>SimpleServlet2</servlet-name>
<url-pattern>/SimpleServlet2</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>


my html page

<html>

<body>
<form action=/SimpleServlet2 method=post>
<table>
<tr>
<td>
<center><input type=submit value="GO"></center>
</td>
</tr>
</table>
</form>
</body>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take the preceding slash out.



Otherwise the browser will at the root of the domain url instead of the root of the contextPath. (http://localhost:8080/ instead of http://localhost:8080/appName/)
[ April 25, 2005: Message edited by: Ben Souther ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic