views:

38

answers:

3

Hello,

i have created a dynamic web page for a servlet. When i try run the project i get the following error:

http starus 500

javax.servlet.ServletException: Error instantiating servlet class ch.uzh.ifi.attempto.aceeditor.MyMainServlet
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
 org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
 org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
 org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
 org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
 java.lang.Thread.run(Unknown Source)

how can i fix this?

A: 

Can you check the following: Are the servlet entries proper in web.xml? (no spelling errors, correct package,...)

Is the servlet class is in classpath, in the same path as given in web.xml?

Looks like one of these.

What server are you using?

Nivas
Looks like Tomcat from the stack trace. Posting servlet code won't help. This is a deployment issue.
duffymo
@duffymo yes this looks like a deployment issue. Wanted to know the web.xml entries and validate that the servlet name/package is exactly the same. Thats why asked for servlet code. Perhaps should have asked more directly. Edited.
Nivas
+1  A: 

Can't tell from the stack trace - could be any number of things:

  1. Servlet .class file doesn't exist
  2. Servlet .class file not in proper package directory structure
  3. Servlet .class file not under WEB-INF/classes
  4. Servlet not registered properly in web.xml
  5. WAR file isn't correct.
  6. WAR file not deployed correctly.
  7. URL used to invoke servlet is incorrect.

I'd recommend starting with this and carefully reviewing what you've done, step by step.

duffymo
Hope it helps - looks like he's relying on eclipse, so it could be an eclipse related configuration issue too...
Andreas_D
Agreed - I think that's a bad idea until you can deploy manually without Eclipse.
duffymo
A: 

I found that a basic test servlet is working. The basic servlet extends the class HttpServlet.

The servlet i want to run extends the WebContainerServlet class, so i believe that this is the source of the error.

The error i get now is

javax.servlet.ServletException: Error allocating a servlet instance org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) ... do you need me to post all the stack trace?

raxvan