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.
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
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...