It's not a secret anymore!*
The moose likes Servlets and the fly likes Error 500. Something's with my CLASSPATH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error 500. Something Watch "Error 500. Something New topic
Author

Error 500. Something's with my CLASSPATH

Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40
I had the HelloWorldExample working some other day, and today, it can't again.

----Some other day--------------------------------------------------------
I edited the web.xml to include <servlet> and <servlet-mapping>, pulled the HelloWorldExample.class file into "C:\Tomcat5\webapps\monday\WEB-INF\classes"
It worked when I typed "http://localhost:8080/monday/servlet/HelloWorldExample"

My CLASSPATH was "c:/j2sdk1.4.2_03/lib/servlet.jar"

----Today--------------------------------------------------------------------

I recompiled HelloWorldExample and did the same thing and I got error500 and error 404 (on refresh).

Before that, I changed my CLASSPATH to \lib\tools.jar
Does the CLASSPATH override each other or do they append to each other?
And how do I check what my CLASSPATH is?

-----Error 500--------------------------------------------------------------
javax.servlet.ServletException: Error instantiating servlet class HelloWorldExample
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Unknown Source)

root cause

java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class HelloWorldExample with modifiers ""
sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Unknown Source)

-----Error 404 (upon refreshing the page that showed Error 500) -----------

Servlet HelloWorldExample is not available

description The requested resource (Servlet HelloWorldExample is not available) is not available.
---------------------------------------------------------------------------


Do you have a parka?<br /> <br /><a href="http://sg.geocities.com/inschooool" target="_blank" rel="nofollow">Visit my homepage</a> | <a href="http://parka.deviantart.com/" target="_blank" rel="nofollow">Parka Deviantart gallery</a>
Parka Teoh
Ranch Hand

Joined: Aug 28, 2004
Posts: 40
Solved my own problem, argh. (really wanted to knock into a wall)

Had to add "public" in front of my class in my source code.

-----------------------------------------------------------

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

//the "public below this line
public class MessageServlet extends HttpServlet {

-----------------------------------------------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error 500. Something's with my CLASSPATH
 
Similar Threads
Error allocating a servlet instance
tomcat error 500- when executing loginservlet example
Name based virtual hosts
The server encountered an internal error () that prevented it from fulfilling this re
My First WebApplication Exception