java - Unable to find a factory for http://www.w3.org/2001/XMLSchema -


i'm having annoying problems following code, worked okay until switched java 1.7

import javax.xml.validation.schemafactory; schemafactory factory = schemafactory.newinstance(xmlconstants.w3c_xml_schema_ns_uri); 

running netbeans -djaxp.debug=1, following error thrown:

the above snipped code part of osgi bundle

jaxp: using thread context class loader (sun.misc.launcher$appclassloader@5e3a78ad) search jaxp: looking system property 'javax.xml.validation.schemafactory:http://www.w3.org/2001/xmlschema' jaxp: property undefined. jaxp: found null in $java.home/jaxp.properties jaxp: no meta-inf/services/javax.xml.validation.schemafactory file found jaxp: attempting use platform default xml schema validator jaxp: instanciating org.apache.xerces.jaxp.validation.xmlschemafactory jaxp: failed instanciate org.apache.xerces.jaxp.validation.xmlschemafactory java.lang.classnotfoundexception: org.apache.xerces.jaxp.validation.xmlschemafactory @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) @ javax.xml.validation.schemafactoryfinder.createinstance(unknown source) @ javax.xml.validation.schemafactoryfinder._newfactory(unknown source) @ javax.xml.validation.schemafactoryfinder.newfactory(unknown source) @ javax.xml.validation.schemafactory.newinstance(unknown source) jaxp: unable find factory http://www.w3.org/2001/xmlschema exception in thread "awt-eventqueue-0" java.lang.illegalargumentexception: http://www.w3.org/2001/xmlschema 

i have made small java app factory instance

schemafactory factory = schemafactory.newinstance(xmlconstants.w3c_xml_schema_ns_uri); 

the factory instance of "com.sun.org.apache.xerces.internal.jaxp.validation.xmlschemafactory" while in bundle tries instantiate "org.apache.xerces.jaxp.validation.xmlschemafactory" (and fails finding it).

why difference ? seems problem, ideea ?

this work me on jre 7:

schemafactory factory = schemafactory.newinstance(xmlconstants.w3c_xml_schema_ns_uri); schema schema = factory.newschema(new saxsource(new inputsource(new bytearrayinputstream(xsd.getbytes())))); validator validator = schema.newvalidator();  validator.validate(new saxsource(new inputsource(new bytearrayinputstream(xml.getbytes())))); system.out.println("validated !"); 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -