This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error 500. Something's with my CLASSPATH

 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
---------------------------------------------------------------------------
 
Parka Teoh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 {

-----------------------------------------------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic