File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet Can't load Class (urgent) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Can Watch "Servlet Can New topic

Servlet Can't load Class (urgent)

Frank M

Joined: May 14, 2001
Posts: 2
Hi guys
I have a class which parses a schema and creates an XML document from the schema.It works fine but when I try to write it as a servlet application, I get the following internal server error:
java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException
at java.lang.ClassLoader.resolveClass0(Native Method)
at java.lang.ClassLoader.resolveClass(
at com.sun.web.core.ServletLoader.loadClass(
at com.sun.web.core.ServletLoader.loadServlet(
at com.sun.web.core.ServletWrapper.loadServlet(
at com.sun.web.core.ServletWrapper.handleRequest(
at com.sun.web.core.InvokerServlet.service(
at javax.servlet.http.HttpServlet.service(
at com.sun.web.core.ServletWrapper.handleRequest(
at com.sun.web.core.Context.handleRequest(
at Code)
Normal servlets work fine except this one.
I tried changing the classpath but no joy.
I was wondering if any body out there had a similar problem and could give me some advice.
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
"Frank M",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Some servers basically ignore the CLASSPATH; instead, there is one hardcoded in the server's main jar. To use the parser classes, you would need to put them in your web-application's WEB-INF/lib or WEB-INF/classes directory (for jars and .class files, respectively). Have you tried stuffing your XML parser jar in WEB-INF/lib?
... By the way, most or all servers have their own XML parser. But it's best not to depend on that, after all, it would introduce a server dependency.
- Peter

[This message has been edited by Peter den Haan (edited May 15, 2001).]
I agree. Here's the link:
subject: Servlet Can't load Class (urgent)
It's not a secret anymore!