xml parsing - Any Alternate Solution to Xml Unmarshalling Error in Java-8? : “secure-processing org.xml.sax.SAXNotRecognizedException" -
note: error has been discussed here , various solutions have been suggested rid of jars conflicts java-8's default implementation.
my question extension problem.
for sake of completeness, here stacktrace facing, when run code java-8:
feb 29, 2016 12:06:41 pm com.sun.xml.internal.bind.v2.util.xmlfactory createparserfactory severe: null org.xml.sax.saxnotrecognizedexception: http://javax.xml.xmlconstants/feature/secure-processing @ org.apache.xerces.parsers.abstractsaxparser.setfeature(abstractsaxparser.java:1487) @ org.apache.xerces.jaxp.saxparserimpl.setfeatures(saxparserimpl.java:145) @ org.apache.xerces.jaxp.saxparserimpl.<init>(saxparserimpl.java:128) @ org.apache.xerces.jaxp.saxparserfactoryimpl.newsaxparserimpl(saxparserfactoryimpl.java:112) @ org.apache.xerces.jaxp.saxparserfactoryimpl.setfeature(saxparserfactoryimpl.java:140) @ com.sun.xml.internal.bind.v2.util.xmlfactory.createparserfactory(xmlfactory.java:121) @ com.sun.xml.internal.bind.v2.runtime.unmarshaller.unmarshallerimpl.getxmlreader(unmarshallerimpl.java:139) @ com.sun.xml.internal.bind.v2.runtime.unmarshaller.unmarshallerimpl.unmarshal(unmarshallerimpl.java:276)
to prove conflicting jar(s) indeed problem (as described in link shared earlier), did pull out relevant code different project , ran code using java-8 (i.e. without errors) bare minimum number of jars. far good.
and query:
in case, legacy project uses 2-3 known conflicting jars used various reasons. however, there new module uses annotation driven jaxb oxm processing.
the problem is : can not rid of old , conflicting jars pretty makes 10% of codebase uncompilable. however, @ same time, not wish rid of jaxb/oxm implementation in new module well.
is there way can somehow tell jvm ignore old jars , use default implementation shipped java-8 whenever code execution goes through new module?
an alternative approach use stax parser xml xmlstreamreader
, have jaxb unmarshal that.
xmlinputfactory xmlinputfactory = xmlinputfactory.newinstance(); xmlstreamreader xmlstreamreader = xmlinputfactory.createxmlstreamreader(reader); unmarshaller.unmarshal(xmlstreamreader);
Comments
Post a Comment