CXF异常 No DestinationFactory was found for the namespace http://schemas.xmlsoap.org

本文针对在启动WebService过程中遇到的ServiceConstructionException异常进行了深入探讨。主要原因是配置文件缺失关键配置项或者依赖的CXF jar包存在问题。通过补充配置文件中的资源导入和替换为最新版本的CXF jar包,成功解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近学习webservice一运行就遇到了这个异常,郁闷。网上发现关于这个异常也是众说纷纭

Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:134)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:160)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:322)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:244)
... 16 more
Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://schemas.xmlsoap.org/soap/http.
at org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactory(DestinationFactoryManagerImpl.java:115)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:86)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)


经过一番折腾后终于可以了,原因一般有俩个:

1.是配置文件中缺少

<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

2.干脆就是jar包的问题

下载最新的CXF 将\lib下的所有jar导入,再运行,奇迹出现了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值