X
Xavier Seneque
hi everybody !
i'm making a little program to parse an xml stream, and learn how it works,
but i have some troubles with it...
i first looked on the sun.com site :
http://developers.sun.com/sw/building/codesamples/sax/index.html
i did lots of cut&past, changed a little, it compiles, but while running,
it miserably fails
[java] Provider
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl not found
[java] javax.xml.parsers.FactoryConfigurationError: Provider
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl not found
[java] at
javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:113)
[java] at sheepim.servrep.ClientHandler.create(Unknown Source)
[java] at sheepim.servrep.ClientHandler.run(Unknown Source)
[java] java.lang.NullPointerException
[java] at sheepim.servrep.ClientHandler.parse(Unknown Source)
[java] at sheepim.servrep.ClientHandler.run(Unknown Source)
if i have understood the error, it's because my jre can't create a
SAXParserFactory object with the static method newInstance() ...
@see :
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()
their is my create method :
private void create() {
try {
// Obtain a new instance of a SAXParserFactory.
SAXParserFactory factory = SAXParserFactory.newInstance();
// Specifies that the parser produced by this code will
provide support for XML namespaces.
factory.setNamespaceAware(true);
// Specifies that the parser produced by this code will
validate documents as they are parsed.
factory.setValidating(true);
// Creates a new instance of a SAXParser using the
currently configured factory parameters.
saxParser = factory.newSAXParser();
}
catch( FactoryConfigurationError e ){
System.err.println(e.getMessage());
System.err.println();
e.printStackTrace();
}
catch (Throwable t) {
System.err.println("Erreur dans la creation du parseur SAX");
t.printStackTrace();
}
}
so it's just a cut & paste from sun.com... so it shouldnt come from their !
after looking on the api documentation, it seems that in order for newInstance()
to work, the javax.xml.parsers.SAXParserFactory property must be properly
configured... but how ? and what do i put in it .
or i can also configur the lib/jaxp.properties file in the jre,
but same problem, what do i put it in ?
info on my box :
java -version
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
javac -version
javac 1.5.0_01
debian linux 2.6.8
thanks in advance for everyone having the patience to give some
interest in my problem !
xs
i'm making a little program to parse an xml stream, and learn how it works,
but i have some troubles with it...
i first looked on the sun.com site :
http://developers.sun.com/sw/building/codesamples/sax/index.html
i did lots of cut&past, changed a little, it compiles, but while running,
it miserably fails
[java] Provider
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl not found
[java] javax.xml.parsers.FactoryConfigurationError: Provider
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl not found
[java] at
javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:113)
[java] at sheepim.servrep.ClientHandler.create(Unknown Source)
[java] at sheepim.servrep.ClientHandler.run(Unknown Source)
[java] java.lang.NullPointerException
[java] at sheepim.servrep.ClientHandler.parse(Unknown Source)
[java] at sheepim.servrep.ClientHandler.run(Unknown Source)
if i have understood the error, it's because my jre can't create a
SAXParserFactory object with the static method newInstance() ...
@see :
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/parsers/SAXParserFactory.html#newInstance()
their is my create method :
private void create() {
try {
// Obtain a new instance of a SAXParserFactory.
SAXParserFactory factory = SAXParserFactory.newInstance();
// Specifies that the parser produced by this code will
provide support for XML namespaces.
factory.setNamespaceAware(true);
// Specifies that the parser produced by this code will
validate documents as they are parsed.
factory.setValidating(true);
// Creates a new instance of a SAXParser using the
currently configured factory parameters.
saxParser = factory.newSAXParser();
}
catch( FactoryConfigurationError e ){
System.err.println(e.getMessage());
System.err.println();
e.printStackTrace();
}
catch (Throwable t) {
System.err.println("Erreur dans la creation du parseur SAX");
t.printStackTrace();
}
}
so it's just a cut & paste from sun.com... so it shouldnt come from their !
after looking on the api documentation, it seems that in order for newInstance()
to work, the javax.xml.parsers.SAXParserFactory property must be properly
configured... but how ? and what do i put in it .
or i can also configur the lib/jaxp.properties file in the jre,
but same problem, what do i put it in ?
info on my box :
java -version
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
javac -version
javac 1.5.0_01
debian linux 2.6.8
thanks in advance for everyone having the patience to give some
interest in my problem !
xs