Discussion:
Tomcat in Eclipse Error 500 java.lang.ClassNotFoundException
Vitalstatistix
2010-06-09 14:07:51 UTC
Permalink
Hey, I've just been working on this tutorial here:

http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html

It has been pretty good and I've got the jsp page to show the time but when
I try going to the
HelloServlet I get the error 500.

http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html

Error Report
type Exception report

message

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

exception

javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)


root cause

java.lang.ClassNotFoundException: com.example.servlets.HelloServlet

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)

org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)


web.xml file generated in my Eclipse web project

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>FirstWebProject</display-name>
<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>
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>


Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as in
the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?

Thanks heaps,

:)
--
View this message in context: http://old.nabble.com/Tomcat-in-Eclipse-Error-500-java.lang.ClassNotFoundException-tp28830890p28830890.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
Christopher Schultz
2010-06-09 18:38:33 UTC
Permalink
To whom it may concern,
Post by Vitalstatistix
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
It has been pretty good and I've got the jsp page to show the time but when
I try going to the HelloServlet I get the error 500.
[...]
javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on
Looks like Tomcat can't find your servlet class.
Post by Vitalstatistix
root cause
java.lang.ClassNotFoundException: com.example.servlets.HelloServlet
Okay, so you've gotten to the "Hello World Servlet" section? Do you have
this line of code at the very top of the file:

package com.example.servlets

?

Check the exact spelling: it's important.
Post by Vitalstatistix
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
This definition looks correct.
Post by Vitalstatistix
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
This mapping is correct. You are visiting
http://yoursite/example/HelloServlet and getting 500, then?
Post by Vitalstatistix
Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as in
the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?
I'm not sure where Eclipse puts all its files, but if you could
track-down the location of the deployment directory (often something
like /foo/bar/tomcat-x.y.z/webapps/example) and give us a file listing
including subdirectories and files in those subdirectories, we might be
able to help.

- -chris
Vitalstatistix
2010-06-10 01:19:08 UTC
Permalink
Hey thanks 4 the response,

Yes, I do have:

package com.example.servlets;

At the top of my HelloServlet.java file.

So still stuck :(
Post by Vitalstatistix
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
It has been pretty good and I've got the jsp page to show the time but
when I try going to the
HelloServlet I get the error 500.
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Error Report
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: com.example.servlets.HelloServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
web.xml file generated in my Eclipse web project
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>FirstWebProject</display-name>
<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>
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as
in the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?
Thanks heaps,
:)
--
View this message in context: http://old.nabble.com/Tomcat-in-Eclipse-Error-500-java.lang.ClassNotFoundException-tp28830890p28837645.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
Caldarale, Charles R
2010-06-10 02:10:26 UTC
Permalink
Subject: Re: Tomcat in Eclipse Error 500
java.lang.ClassNotFoundException
package com.example.servlets;
At the top of my HelloServlet.java file.
And where exactly is the .class file located?

What happens if you run Tomcat directly, not under Eclipse?

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Vitalstatistix
2010-06-10 02:20:37 UTC
Permalink
SOLVED:

There was no HelloServlet.class file so I had to put an empty main method
into the HelloServlet.java class and run it to generate the
HelloServlet.class file, then I placed the class file in the WEB-INF folder
and it all worked fine.

Thanks
Post by Vitalstatistix
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
It has been pretty good and I've got the jsp page to show the time but
when I try going to the
HelloServlet I get the error 500.
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Error Report
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: com.example.servlets.HelloServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
web.xml file generated in my Eclipse web project
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>FirstWebProject</display-name>
<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>
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as
in the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?
Thanks heaps,
:)
--
View this message in context: http://old.nabble.com/Tomcat-in-Eclipse-Error-500-java.lang.ClassNotFoundException-tp28830890p28838037.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
Pid
2010-06-10 09:18:15 UTC
Permalink
Post by Vitalstatistix
There was no HelloServlet.class file so I had to put an empty main method
into the HelloServlet.java class and run it to generate the
HelloServlet.class file, then I placed the class file in the WEB-INF folder
and it all worked fine.
Er, what?

1. There's no need for an empty main method.
2. We usually just compile a .java file to get a .class


p
Post by Vitalstatistix
Post by Vitalstatistix
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
It has been pretty good and I've got the jsp page to show the time but
when I try going to the
HelloServlet I get the error 500.
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Error Report
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: com.example.servlets.HelloServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
web.xml file generated in my Eclipse web project
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>FirstWebProject</display-name>
<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>
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as
in the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?
Thanks heaps,
:)
Vitalstatistix
2010-06-11 04:21:44 UTC
Permalink
Yeh that was just a dodgy hack to get around my initial errors when using
javac. I found out later the reason why javac wasn't working on my servlet
class was because servlet-api.jar wasn't on the classpath,
after adding that I was able to compile it the normal way. Also the solution
is NOT to put it in the WEB-INF folder, you need to have your .class file in
the build/classes/<Yourpackage> folder.
Post by Pid
Post by Vitalstatistix
There was no HelloServlet.class file so I had to put an empty main method
into the HelloServlet.java class and run it to generate the
HelloServlet.class file, then I placed the class file in the WEB-INF folder
and it all worked fine.
Er, what?
1. There's no need for an empty main method.
2. We usually just compile a .java file to get a .class
p
Post by Vitalstatistix
Post by Vitalstatistix
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
It has been pretty good and I've got the jsp page to show the time but
when I try going to the
HelloServlet I get the error 500.
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Error Report
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: com.example.servlets.HelloServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
web.xml file generated in my Eclipse web project
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>FirstWebProject</display-name>
<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>
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as
in the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?
Thanks heaps,
:)
--
View this message in context: http://old.nabble.com/Tomcat-in-Eclipse-Error-500-java.lang.ClassNotFoundException-tp28830890p28851220.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
Pid
2010-06-11 09:21:26 UTC
Permalink
Post by Vitalstatistix
Yeh that was just a dodgy hack to get around my initial errors when using
javac. I found out later the reason why javac wasn't working on my servlet
class was because servlet-api.jar wasn't on the classpath,
after adding that I was able to compile it the normal way. Also the solution
is NOT to put it in the WEB-INF folder, you need to have your .class file in
the build/classes/<Yourpackage> folder.
It'll eventually need to end up in

WEB-INF/classes/my/package.AServlet.class

or, inside a jar, e.g.

WEB-INF/lib/myservlets.jar

or you won't be able to deploy the web app...


p
Post by Vitalstatistix
Post by Pid
Post by Vitalstatistix
There was no HelloServlet.class file so I had to put an empty main method
into the HelloServlet.java class and run it to generate the
HelloServlet.class file, then I placed the class file in the WEB-INF folder
and it all worked fine.
Er, what?
1. There's no need for an empty main method.
2. We usually just compile a .java file to get a .class
p
Post by Vitalstatistix
Post by Vitalstatistix
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
It has been pretty good and I've got the jsp page to show the time but
when I try going to the
HelloServlet I get the error 500.
http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/index.html
Error Report
type Exception report
message
description The server encountered an internal error () that prevented it
from fulfilling this request.
exception
javax.servlet.ServletException: Wrapper cannot find servlet class
com.example.servlets.HelloServlet or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.ClassNotFoundException: com.example.servlets.HelloServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Unknown Source)
web.xml file generated in my Eclipse web project
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>FirstWebProject</display-name>
<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>
<servlet>
<description></description>
<display-name>HelloServlet</display-name>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>com.example.servlets.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
Sorry I don't know how to add code tags in this forum. I'm using Tomcat 6.
I've
made no changes to ANY web.xml files, I simply followed that short basic
tutorial step by step. My HelloServlet.java class is exactly the same as
in the tutorial and is in the same package.
Could you please tell me why it can't seem to find the class?
Thanks heaps,
:)
Loading...