为什么jboss使用过时的DOMSerializerImpl org.apache.xerces 2.12.0.SP03

ws51t4hk  于 2023-02-04  发布在  Apache
关注(0)|答案(1)|浏览(157)

我在部署时遇到了一个问题,将键值放入infinispan缓存某个对象ISPN000559: Cannot marshall 'class org.infinispan.marshall.protostream.impl.MarshallableUserObject': org.w3c.dom.ls.LSException
从stacktrace中,我看到它从已弃用的类中调用org.apache.xerces@2.12.0.SP03//org.apache.xml.serialize.DOMSerializerImpl.writeToString(DOMSerializerImpl.java:518),但据我所知,它应该使用xalan serializer 2.7.2
当我尝试从我们的应用程序序列化它时,它使用了正确的序列化器,使用了xercesImpl-2.12.2 www.example.com中的代码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;
    }

请帮助我理解为什么部署时使用了不正确的序列化程序,以及如何修复它;WEB-INF\lib\中存在所需的库xalan-2.7.2
orgWildflyVersion = '26.1.2.最终版'无限扩展版本= '13.0.10.最终版'

gwbalxhn

gwbalxhn1#

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

相关问题