从Plain Java调用Apache CXF Client时无法创建安全的XMLInputFactory

时间:2015-07-22 03:45:40

标签: apache cxf

我试图从简单Java代码调用Apache CXF服务,如下所示

public static void main(String args[])
{
Call Apache CXF Service ....
}

我没有得到任何编译时错误,但获得运行时异常如下

Exception in thread "main" java.lang.RuntimeException: Cannot create a secure XMLInputFactory
    at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:314)
    at org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory(StaxUtils.java:264)
    at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1457)
    at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1110)
    at org.apache.cxf.bus.extension.XmlExtensionFragmentParser.getExtensions(XmlExtensionFragmentParser.java:46)
    at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:183)
    at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:159)
    at org.apache.cxf.bus.extension.ExtensionManagerImpl.load(ExtensionManagerImpl.java:108)
    at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:121)
    at org.apache.cxf.bus.extension.ExtensionManagerBus.<init>(ExtensionManagerBus.java:134)
    at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:40)
    at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:36)
    at org.apache.cxf.bus.CXFBusFactory.createBus(CXFBusFactory.java:32)
    at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:106)
    at org.apache.cxf.BusFactory.createThreadBus(BusFactory.java:243)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:227)
    at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:214)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:89)
    at javax.xml.ws.Service.<init>(Unknown Source)

我的依赖关系如下

cxf-rt-frontend-jaxws-2.7.12.jar
cxf-api-2.7.12.jar
woodstox-core-asl-4.4.0.jar
stax2-api-3.1.4.jar
xmlschema-core-2.1.0.jar
cxf-rt-core-2.7.12.jar
jaxb-impl-2.1.13.jar
cxf-rt-bindings-soap-2.7.12.jar
cxf-rt-databinding-jaxb-2.7.12.jar
cxf-rt-bindings-xml-2.7.12.jar
cxf-rt-frontend-simple-2.7.12.jar
cxf-rt-ws-addr-2.7.12.jar
cxf-rt-ws-policy-2.7.12.jar
cxf-rt-transports-http-2.7.12.jar

请帮我解决这个错误

注意: - 我没有pom.xml。我使用传统的“lib”文件夹来放置我的依赖罐子

1 个答案:

答案 0 :(得分:0)

我添加了这三行并且工作正常

a.sort(key=attrgetter('LName', 'Fname'))