aspose file tools*
The moose likes Servlets and the fly likes servlet error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet error" Watch "servlet error" New topic
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: 191

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: 61761
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 61761
    
  67

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: 61761
    
  67

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: 191

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet error