| Author |
servlet error
|
Kostas Anastasiou
Greenhorn
Joined: Oct 08, 2011
Posts: 6
|
|
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error instantiating servlet class MyServlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:679)
root cause
java.lang.ClassNotFoundException: MyServlet
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:679)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.22 logs.
can anyone help why browser turns out these errors?
|
 |
German Gonzalez-Morris
Ranch Hand
Joined: Nov 16, 2009
Posts: 47
|
|
Do you have a servlet declared in your web.xml called MyServlet ?
Please paste your web.xml to see more details.
|
http://devwebcl.blogspot.com/
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
Be sure that your servlet is in a package other than the default, and that the class file is placed in the correct folder hierarchy that matches the package under WEB-INF/classes.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Welcome to JavaRanch
|
 |
Kostas Anastasiou
Greenhorn
Joined: Oct 08, 2011
Posts: 6
|
|
Seetharaman Venkatasamy wrote:Welcome to JavaRanch 
Hi, Seetharaman Venkatasamy,I'm happy to be here!
I've posted MyServlet.class to /usr/local/apache-tomcat-7.0.22/webapps/ROOT/WEB-INF/classes
and this is my web.xml file.
The link I put to my browser is http://localhost/my
Τo tell the truth on my computer that process works, but has done exactly the same and a friend(maybe ) and takes out the above errors. And I don't know what to tell him to look back, The .class and .xml files are exactly the same.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
I already answered the question.
|
 |
Kostas Anastasiou
Greenhorn
Joined: Oct 08, 2011
Posts: 6
|
|
thanks, but I've been confused!
which is the default package for my servlet?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
Basic Java: The default package is the unnamed package that classes get put into when you don't give it an explicit package. All classes in a web application need to be in an explicit package. Sometimes, a servlet will work when placed in the default package, but most often it will not. Are you a gambling man?
|
 |
German Gonzalez-Morris
Ranch Hand
Joined: Nov 16, 2009
Posts: 47
|
|
Does you Myservlet have a package ?
You need to assure that yo are calling the right web application (with the righ URL), this application must have in the web.xml the mapping plus the servlet and has deployed under WEB-INF/classes the servlet under the correct package. (considering if it is default, as mentioned).
Tomcat brings Servlets deployed as example, maybe you may like to work from there.
|
 |
 |
|
|
subject: servlet error
|
|
|