通过Maven的CXF 2.7.x Woodstox兼容性 [英] CXF 2.7.x Woodstox Compatibility via Maven

查看:391
本文介绍了通过Maven的CXF 2.7.x Woodstox兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CXF的文档中,据说2.7.x版本要求不在4.2.0版本下的Woodstox jar在类路径中可用。

In the CXF's documentation it is said that the 2.7.x version requires the Woodstox jars not under the 4.2.0 version to be available in the classpath.

有人可以建议Maven依赖Woodstox与CXF合作吗?

主要问题是当我尝试使用cxf的客户端时,会引发异常无法创建安全的XMLInputFactory。根据不同的论坛(例如),有可能使用org.apache.cxf.stax.allowInsecureParser系统属性来解决问题,但这似乎不是一个好方法。所以maven依赖是要走的路......

The main problem is when I try to use the cxf's client, an exception "Cannot create a secure XMLInputFactory" is raised. According to different forums (for example), it is possible to use the "org.apache.cxf.stax.allowInsecureParser" system property to solve the problem, but it seems not a good way. So that maven dependencies are the way to go...

提前致谢。

推荐答案

好吧,最后我得到了一个解决方案。首先,我要感谢StaxMan的帮助。

Well, finally I've got a solution. First of all I'd like to thank StaxMan for a help.

我的环境是:
Weblogic 11g,CXF 2.7.5

My environment is: Weblogic 11g, CXF 2.7.5

问题是WLS已经包含StAX API和xml解析器的实现,这就是为什么应用程序在使用CXF时看不到Woodstox解析器的原因。

The problem is WLS already contains implementations for StAX API and xml parsers that is why an application doesn't see the Woodstox parser when using CXF.

这是pom.xml:

        <!-- CXF -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
        </dependency>

和主要部分 - 位于资源/ META-INF /中的weblogic-application.xml :

and the main part -- the weblogic-application.xml located in the resources/META-INF/ :

    <prefer-application-packages>
        <package-name>com.ctc.wstx.*</package-name>
        <package-name>org.apache.*</package-name>
    </prefer-application-packages>

请注意,如果这样做,可能会出现NoClassDefinition错误。如果是这样,请添加包含缺少类的maven依赖项。

Be aware of the fact that if do so there may occure the "NoClassDefinition" errors. If so, please, add maven dependencies that contain missing classes.

希望这有助于某人。

这篇关于通过Maven的CXF 2.7.x Woodstox兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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