Java – jaxp API that is not valid when unmarshalling JAXB

I have a JAXB object that I can ungroup very well However, if I add an element [] field annotated with @ xmlanyelement, the following will be thrown when trying to ungroup:

This is run through the TestNG test I ran through the eclipse plug - in I'm running the 1.6 JDK and configuring Maven to exclude older versions of XML APIs jars, but I don't seem to be able to make it work I suppose I still pick up incompatible library versions from somewhere, but I don't know where they come from

Running directly through eclipse, I get:

29-Aug-2013 10:04:08 com.sun.xml.bind.v2.util.XmlFactory createTransformerFactory
SEVERE: null
java.lang.AbstractMethodError: javax.xml.transform.TransformerFactory.setFeature(Ljava/lang/String;Z)V
    at com.sun.xml.bind.v2.util.XmlFactory.createTransformerFactory(XmlFactory.java:155)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.createTransformerHandler(JAXBContextImpl.java:747)
    at com.sun.xml.bind.v2.runtime.unmarshaller.DomLoader$State.<init>(DomLoader.java:75)
    at com.sun.xml.bind.v2.runtime.unmarshaller.DomLoader.startElement(DomLoader.java:118)
    at com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:60)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:501)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:480)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:150)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(UnkNown Source)
    at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(UnkNown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(UnkNown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(UnkNown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(UnkNown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(UnkNown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(UnkNown Source)
    at org.apache.xerces.parsers.XMLParser.parse(UnkNown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(UnkNown Source)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:218)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:190)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
    at com.gtspt.vrs.parser.AbstractParserTest.unmarshal(AbstractParserTest.java:33)
    at com.gtspt.vrs.parser.AbstractParserTest.testParser(AbstractParserTest.java:26)
    at com.gtspt.vrs.parser.TestResultsParser.testParser(TestResultsParser.java:17)
    at com.gtspt.vrs.parser.Test.main(Test.java:16)

Solution

It seems that this problem is caused by the old version of xalan Starting with JDK 5, it seems that a minimum version of 2.7.0 is required 0. Another library provides an old version, so I excluded it from Maven build. Now everything looks good

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>