Tomcat 5.0.16 and NoClassDefFoundError problems

C

Carl Howells

I'm working on setting up a small web store with Tomcat and JSP/Servlet
stuff. Anywhere, somewhere along the line today, I broke Tomcat. Now,
when I try to access any servlet that's declared in web.xml, I get the
following errors:

------

HTTP Status 500 -

type: Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception:

javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:805)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:696)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
java.lang.Thread.run(Thread.java:534)

root cause:

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:537)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
java.net.URLClassLoader.access$100(URLClassLoader.java:55)
java.net.URLClassLoader$1.run(URLClassLoader.java:194)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:187)
java.lang.ClassLoader.loadClass(ClassLoader.java:289)
java.lang.ClassLoader.loadClass(ClassLoader.java:282)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
java.lang.ClassLoader.loadClass(ClassLoader.java:235)

note: The full stack trace of the root cause is available in the Tomcat
logs.

-------

Anyway, somehow today, I managed to make tomcat lose
javax.servlet.http.HttpServlet. It worked fine yesterday. Strangely,
JSP's still work just fine, too. So, what part of the classpath did I
screw up?

Here's what I did today, if that helps:
-Configured and enabled SSL
-Changed the global Realm to org.apache.catalina.realm.JAASRealm
-Wrote a LoginModule and configured the JAAS Realm to use it for
authentication. (we're using a non-SQL db for the password info on the
backend.) I suspect this is most likely what broke it, because I had to
deal with class loading issues at this point. Specifically, my
LoginModule had to be someplace where it would be loaded somewhere early
in the load process. I ended up jarring it and putting it into my ext
directory, which solved that problem.

It was only after all this that I noticed that servlets had broken.

So, I've noticed tomcat is very fussy about classloading in the past...
This probably can be fixed with only minimal changes, if I knew where
to look. What are some of the places where I may have caused Tomcat to
give this error message, and what should I do to check those places.

Thanks,
Carl
 
C

Carl Howells

Carl said:
Anyway, somehow today, I managed to make tomcat lose
javax.servlet.http.HttpServlet. It worked fine yesterday. Strangely,
JSP's still work just fine, too. So, what part of the classpath did I
screw up?

Figured it out... I managed to accidently copy that particular servlet into the jar
I made, and so that servlet was being loaded by the bootstrap classloader. And as
far as that classloader know, there was no javax.servlet.http.HttpServlet class.
Just another stupid mistake on my part.

Anyway, thanks to anyone who spent some time looking at this and wasn't able to help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top