gpt4 book ai didi

grails - org.apache.xml.serializer.ToXMLSAXHandler 在使用 XmlUtil.serialize() 时无法在 JBOSS 中强制转换为 org.apache.xml.serializer.SerializationHandler

转载 作者:行者123 更新时间:2023-12-02 13:55:30 29 4
gpt4 key购买 nike

我正在尝试使用 XmlParser 从 xml 文件中删除和添加标签。以下是我在使用“grails run-app”命令部署的 grails 应用程序中执行时运行良好的代码块:

def parser = new XmlParser()
def xmlTemplate = parser.parse(file1)
def origFile = parser.parse(file2)

for (def n : origFile.cars)
{
origFile.remove(n)
}


def children = origFile.children()
int i = 0 ;
for (def n : xmlTemplate.cars)
{
children.add(i,n)
i++
}

new File(finalFileName).write( XmlUtil.serialize(origFile) )

但是,当我将此代码作为 war 部署在 JBOSS 服务器上时,它会在调用时引发以下错误:
13:50:36,312 INFO  [stdout] (http-/10.64.96.82:8080-28) org.apache.xml.serializer.utils.WrappedRuntimeException: org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to org.apache.xml.serializer.SerializationHandler
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at org.apache.xml.serializer.SerializerFactory.getSerializer(SerializerFactory.java:179)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at org.apache.xalan.transformer.TransformerIdentityImpl.createResultContentHandler(TransformerIdentityImpl.java:260)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:330)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at groovy.xml.XmlUtil.serialize(XmlUtil.java:448)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at groovy.xml.XmlUtil.serialize(XmlUtil.java:437)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at groovy.xml.XmlUtil.serialize(XmlUtil.java:179)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at groovy.xml.XmlUtil.serialize(XmlUtil.java:88)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at groovy.xml.XmlUtil$serialize.call(Unknown Source)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
13:50:36,312 INFO [stdout] (http-/10.64.96.82:8080-28) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)

我在 https://issues.jboss.org/browse/JBEAP-19 上发现了类似的问题它建议从包中删除 xalan serializer-2.7.1.jar 并且在从应用程序 war 中删除此 jar 后它确实工作正常。
jar serializer-2.7.1.jar 是我的 war 文件的一部分,因为我使用“grails war”命令创建了 war ,我不确定它在哪里使用。我的应用程序在删除 jar 后运行良好,所以看起来grails 框架也没有在任何地方内部使用这个 jar。

谁能解释这个问题的根本原因是什么,以及在 grails 应用程序中 serializer-2.7.1.jar 的用途是什么?

最佳答案

为了他人的利益:似乎OP的答案包含在问题中:

I found a similar issue on https://issues.jboss.org/browse/JBEAP-19 which suggested to remove xalan serializer-2.7.1.jar from the package and it indeed works fine after removing this jar from the application war. The jar serializer-2.7.1.jar was part of my war file as I created the war using "grails war" command and I am not sure where it was being used.My app is running fine after the removal of jar so it seems the grails framework is also not using this jar internally anywhere.

关于grails - org.apache.xml.serializer.ToXMLSAXHandler 在使用 XmlUtil.serialize() 时无法在 JBOSS 中强制转换为 org.apache.xml.serializer.SerializationHandler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33384578/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com