Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XML Parsing

1 view
Skip to first unread message

James Gralton

unread,
Dec 9, 2002, 9:53:39 AM12/9/02
to
I am getting the following error:


Exception occurred during event dispatching:
javax.xml.parsers.FactoryConfigurationError: Provider
org.apache.xerces.jaxp.SAXParserFactoryImpl not found
at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
at classifier.Mapper.getHeuristics(Mapper.java:23)

when executing the following code:

SAXParserFactory factory = SAXParserFactory.newInstance();

The question I have is why do I get this error and how can I avoid it. I do
not know if I have the right librarys as I just want the classes required
which are:

import org.xml.sax.*;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;

I don't want the big jaxp.jar as it is 9 MB and I want to keep the file size
to a minimum.

Can anyone help.

Thank you James.

Jon Skeet

unread,
Dec 9, 2002, 10:57:21 AM12/9/02
to

No, you need more than those classes - you need the implementation of
the parser, which is what it's saying it can't find.

Does it work if you *do* have the big jaxp.jar in your classpath or
extensions directory?

--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

James Gralton

unread,
Dec 9, 2002, 11:24:32 AM12/9/02
to
Well I do not have the net on the machine I am implementing the program on
and have no way of transfering a 9MB file to that machine. I have what I
would assume are the right libraries. I have javax.xml.* and org.xml.*
therefore do I need any more why do I need this
org.apache.xerces.jaxp.SAXParserFactoryImpl class. I just followed the java
tutorial on echoing an XML file to system .out.
Thank you
Jon Skeet <sk...@pobox.com> wrote in message
news:MPG.185ecdb83...@dnews.peramon.com...

Jon Skeet

unread,
Dec 10, 2002, 3:52:49 AM12/10/02
to
James Gralton <jim...@yahoo.com> wrote:
> Well I do not have the net on the machine I am implementing the program on
> and have no way of transfering a 9MB file to that machine. I have what I
> would assume are the right libraries.

Clearly your assumptions are wrong, otherwise you wouldn't get an error.
Whether or not you need jaxp.jar is a different matter though - have a
look at http://xml.apache.org and try the parsers available there.

> I have javax.xml.* and org.xml.*
> therefore do I need any more why do I need this
> org.apache.xerces.jaxp.SAXParserFactoryImpl class. I just followed the java
> tutorial on echoing an XML file to system .out.

You need the implementation class because otherwise you don't have an
actual SAXParserFactory. That call to SAXParserFactory.newInstance()
tries to find an appropriate SAXParserFactory implementation - and in
your case, fails. It looks like it's *trying* to find Xerces, but
failing...

0 new messages