简体   繁体   中英

Why jboss uses deprecated DOMSerializerImpl org.apache.xerces 2.12.0.SP03

I've got an issue while deploing with putting key value into the infinispan cache some object ISPN000559: Cannot marshall 'class org.infinispan.marshall.protostream.impl.MarshallableUserObject': org.w3c.dom.ls.LSException

from the stacktrace I see that it calls org.apache.xerces@2.12.0.SP03//org.apache.xml.serialize.DOMSerializerImpl.writeToString(DOMSerializerImpl.java:518) from the deprecated class, but as I understand it should use xalan serializer 2.7.2 instead

when I trying to serialize it from our app, it uses the correct serializer using this code from xercesImpl-2.12.2 CoreDomImplementationImpl.java

public LSSerializer createLSSerializer() {
        try {
            Class serializerClass = ObjectFactory.findProviderClass(
                "org.apache.xml.serializer.dom3.LSSerializerImpl",
                ObjectFactory.findClassLoader(), true);
            return (LSSerializer) serializerClass.newInstance();
        }
        catch (Exception e) {}
        // Fall back to Xerces' deprecated serializer if 
        // the Xalan based serializer is unavailable.
        return new DOMSerializerImpl();
    }

we call it like this

    public static @Null
    String documentToString(@Null Document document) {
        if (document == null) {
            return null;
        }
        DOMImplementationLS domImplementation = (DOMImplementationLS) document.getImplementation();
        LSSerializer lsSerializer = domImplementation.createLSSerializer();

        String result = lsSerializer.writeToString(document);
      
        return result;
    }

please help me to understand why incorrect serializer is used while deploy and how to fix it; needed library xalan-2.7.2 is present in WEB-INF\lib\

orgWildflyVersion = '26.1.2.Final' infinispanVersion = '13.0.10.Final'

adding <module name="org.apache.xalan"/> to jboss-deployment-structure.xml helped

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM