Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Servlet Can't load Class (urgent)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(ClassLoader.java:429)
at com.sun.web.core.ServletLoader.loadClass(ServletLoader.java:124)
at com.sun.web.core.ServletLoader.loadServlet(ServletLoader.java:30)
at com.sun.web.core.ServletWrapper.loadServlet(ServletWrapper.java:81)
at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:109)
at com.sun.web.core.InvokerServlet.service(InvokerServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:140)
at com.sun.web.core.Context.handleRequest(Context.java:375)
at com.sun.web.server.ConnectionHandler.run(Compiled 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.
cheers
Frank
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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 http://www.javaranch.com/name.jsp . 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.
Thanks.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
A timing clock, fuse wire, high explosives and a tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic