繁体   English   中英

创建名称为“ cxf”的bean时出错

[英]Error creating bean with name 'cxf'

我在运行程序时遇到以下错误

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 JAR? 因为这可能是问题所在。

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

可能是因为您使用的是neethi的旧版本(也许是2.XX),而您应该使用3.0.2版本。 检查您的依赖项。

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

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

它可能是由cxf-WebService-Module的类加载器导致的。 确保将WebService-Module的类加载器设置为PARENT_LAST

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM