Jboss EAP 6.x上的org.springframework.ws和Xalan问题 [英] org.springframework.ws and Xalan problem on Jboss EAP 6.x

查看:609
本文介绍了Jboss EAP 6.x上的org.springframework.ws和Xalan问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我在更新org.springframework.ws-spring-xml之后遇到Jboss EAP 6.x的问题

Hello I'm facing problem with Jboss EAP 6.x after update org.springframework.ws - spring-xml

在我的项目中,我在2.7.2版中使用了Xalan,现在我想将org.springframework.ws-spring-xml从2.4.0版更新到2.4.4,并在Jboss EAP 6上上传我的应用程序的war. x

In my project I have use Xalan in version 2.7.2 , now I want to update org.springframework.ws - spring-xml from version 2.4.0 to 2.4.4 and upload wars of my app on Jboss EAP 6.x

部署时出现错误:

原因 提供者:java.lang.IllegalArgumentException:不支持: http://javax.xml.XMLConstants/property/accessExternalDTD org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571) 在 __redirected .__ TransformerFactory.setAttribute(__ TransformerFactory.java:169) [jboss-modules.jar:1.3.5.Final-redhat-1]在 org.springframework.xml.transform.TransformerFactoryUtils.defaultSettings(TransformerFactoryUtils.java:56) 的[spring-xml-2.4.4.RELEASE.jar:] org.springframework.xml.transform.TransformerFactoryUtils.newInstance(TransformerFactoryUtils.java:32) 的[spring-xml-2.4.4.RELEASE.jar:] org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping.(PayloadRootAnnotationMethodEndpointMapping.java:58) [spring-ws-core-2.4.4.RELEASE.jar:] ...还有31个

Caused by: java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLConstants/property/accessExternalDTD at org.apache.xalan.processor.TransformerFactoryImpl.setAttribute(TransformerFactoryImpl.java:571) at __redirected.__TransformerFactory.setAttribute(__TransformerFactory.java:169) [jboss-modules.jar:1.3.5.Final-redhat-1] at org.springframework.xml.transform.TransformerFactoryUtils.defaultSettings(TransformerFactoryUtils.java:56) [spring-xml-2.4.4.RELEASE.jar:] at org.springframework.xml.transform.TransformerFactoryUtils.newInstance(TransformerFactoryUtils.java:32) [spring-xml-2.4.4.RELEASE.jar:] at org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping.(PayloadRootAnnotationMethodEndpointMapping.java:58) [spring-ws-core-2.4.4.RELEASE.jar:] ... 31 more

经过快速调查,我发现在spring-xml 2.4.4版本中,它是新的TransformerFactoryUtils,它使用与Xalan相同的软件包中的TransformerFactory,这导致类加载器出现问题.

After fast investigation I have found that in spring-xml version 2.4.4 it's new TransformerFactoryUtils which uses TransformerFactory from same package as Xalan , and it's leads to problem with classloader.

我尝试遵循 TransformerFactory和Xalan依赖冲突 jboss eap 6.0.1中的xalan和xerces 但两者都不适合我.

I try to follow solutions from TransformerFactory and Xalan Dependency Conflict and xalan and xerces in jboss eap 6.0.1 but both won't work for me.

我还在redhat网站上找到了一些解决方案: https://access.redhat.com/solutions /1410603 ,但没有订阅,我没有访问权限...

I have also found some solution on redhat site : https://access.redhat.com/solutions/1410603 but without subscription I don't have access for it...

和一个人面对同样的问题?在这种情况下也许有一些可行的解决方案?预先感谢.

And one face same issue? Maybe have some solution which may work in this case? Big thanks in advance.

推荐答案

即使对于 JBoss EAP 7.2

由于JBoss在JDK 6、7和8上运行,这就是为什么所包含的 Xalan 不具有ACCESS_EXTERNAL_DTD支持的原因,因为它是在 JDK 7 中添加的.

Since JBoss runs on JDK 6, 7, and 8, that is why the included Xalan does not have ACCESS_EXTERNAL_DTD support as it was added in JDK 7.

您可以强制JBoss使用Oracle JDK 8中的 TransformerFactory .将变量transformerFactoryClass设置为com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.请参见下面的快照.

You may force JBoss to use TransformerFactory from Oracle JDK 8. Set the variable transformerFactoryClass to com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl. See the snapshot below.

final Jaxb2Marshaller marshaller = new Jaxb2Marshaller();

final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
webServiceTemplate.setDefaultUri(uri);
webServiceTemplate.setMarshaller(marshaller);
webServiceTemplate.setUnmarshaller(marshaller);

try {
    logger.debug("Getting class for name: {}", transformerFactoryClass);
    final Class<?> clazz = Class.forName(transformerFactoryClass);
    Assert.isAssignable(TransformerFactory.class, clazz, "Must be instance of Class<? extends TransformerFactory>");
    webServiceTemplate.setTransformerFactoryClass((Class<? extends TransformerFactory>) clazz);
} catch (ClassNotFoundException e) {
    logger.error("Unable to get class for name: {}", transformerFactoryClass);
    throw new IllegalArgumentException(e);
}

这篇关于Jboss EAP 6.x上的org.springframework.ws和Xalan问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆