Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Servlet Error in Tomcat.

Status
Not open for further replies.

Milleniumlegend

IS-IT--Management
Dec 16, 2003
135
Could someone please point me to the right place. I have a servlet that I have placed under
\ROOT\WEB-INF\classes\coreservlets

the Servlet name is HelloServlet.
for some reason when I enter the following URL it does not do anything but produces an error.
Code:
[URL unfurl="true"]http://localhost:8080/servlet/coreservlets.HelloServlet[/URL]

I get the following output on the web browser. Could some one please let me know what could be the cause. 
type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/coreservlets.HelloServlet
	org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:388)
	org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause 

java.lang.NoClassDefFoundError: coreservlets/HelloServlet (wrong name: HelloServlet)
	java.lang.ClassLoader.defineClass1(Native Method)
	java.lang.ClassLoader.defineClass(Unknown Source)
	java.security.SecureClassLoader.defineClass(Unknown Source)
	org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1779)
	org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
	org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
	org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:369)
	org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs.
 
Looks like the HelloServlet class is not named as belonging to package "coreservlets", OR you have compiled it incorrectly, and you have not compiled it to take into account your package "coreservlet"

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top