簡體   English   中英

為什么 jboss 使用已棄用的 DOMSerializerImpl org.apache.xerces 2.12.0.SP03

[英]Why jboss uses deprecated DOMSerializerImpl org.apache.xerces 2.12.0.SP03

我在部署時遇到問題,將鍵值放入 infinispan 緩存一些 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代替

當我嘗試從我們的應用程序序列化它時,它使用正確的序列化程序,使用來自 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();
    }

我們這樣稱呼它

    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;
    }

請幫助我理解為什么在部署時使用了不正確的序列化程序以及如何修復它; 所需的庫 xalan-2.7.2 存在於 WEB-INF\lib\ 中

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

<module name="org.apache.xalan"/>添加到jboss-deployment-structure.xml幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM