【问题标题】:Error creating bean with name 'cxf'创建名为“cxf”的 bean 时出错
【发布时间】:2013-09-20 04:35:20
【问题描述】:

运行程序时出现以下错误

Exception in thread "main" java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf' defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException: Could not load extension class org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.

我的 test.xml 文件是

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:cxf="http://cxf.apache.org/core"
    xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd
    http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">


    <bean id="clientI"
        class="LI" />
    <bean id="clientL"
        class="LIn" />

        <cxf:bus>
        <cxf:outInterceptors>
            <ref bean="clientI" />
        </cxf:outInterceptors>
        <cxf:inInterceptors>
            <ref bean="clientL" />
        </cxf:inInterceptors>
    </cxf:bus>
</beans>

【问题讨论】:

  • 你的类路径中有 cxf-bundle-xxx.jar 吗?
  • 您能否粘贴整个异常链 - 包括所有原因?

标签: java spring web-services spring-mvc


【解决方案1】:

你的类路径中有 cxf-bundle JAR 吗?因为这可能是问题所在。

您可以从这里获取它:http://mvnrepository.com/artifact/org.apache.cxf/cxf-bundle/2.7.6(最新版本)。

【讨论】:

  • 非常感谢老兄。你成就了我的一天
【解决方案2】:

这可能是因为您使用的是旧版本的 neethi(可能是 2.X.X),而您应该使用 3.0.2 版本。检查你的依赖关系。

【讨论】:

    【解决方案3】:

    为了解决问题,我必须同时添加 cxf-bundle-xxx.jar 并使用最新版本更新 neethi jar。

    【讨论】:

      【解决方案4】:

      如果在包含部署在 WebSphere AS 中的 cxf-WebService 的 EAR 上发生这种情况,

      它可能来自 cxf-WebService-Module 的类加载器。请务必将 WebService-Module 的类加载器设置为 PARENT_LAST

      【讨论】:

        猜你喜欢
        • 2015-11-06
        • 2012-05-03
        • 2021-11-28
        • 2020-10-03
        • 2019-08-28
        • 2015-03-18
        • 2021-03-17
        • 2021-06-18
        • 2019-07-21
        相关资源
        最近更新 更多