CXF JAX-RS is causing BusException

浪尽此生 提交于 2020-02-24 12:12:27

问题


After adding a RESTFul service using Apache CXF to my Spring (and Wicket) project I get the following exception:

org.apache.cxf.BusException: No binding factory for namespace http://apache.org/cxf/binding/jaxrs registered.

I have included the row below in my Spring configuration and thought this would actually solve my problem. But it did not.

import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"

Any feedback regarding how to solve this problem or ideas in what areas to look for a solution would be greately appreciated.

I am using Spring 3.0.0.RC2 and Apache CXF 2.2.5. (Maven dependencies to org.springframework.core, org.springframework.test, org.springframework.orm, org.springframework.web and cxf-bundle.)

Thanks in advance.


回答1:


Really I solved the problem by simply importing the resource you mentioned in the main application-context.xml file:

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

I use Spring 4.1.0.RELEASE and cxf 2.2.3.

In past, when I was using Spring 3.0 and Apacy CXF 2.2.2 I did not need to import this file. But now I have the following situation in the main application-context.xml file:

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

and it works fine for me.




回答2:


Problem was resolved by downgrading Spring to version 2.5.6.




回答3:


I had the same problem. I have these three jars as dependency in my pom.xml

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>${cxf.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>${cxf.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-databinding-aegis</artifactId>
        <version>${cxf.version}</version>
    </dependency>

My problem was resolved by deleting these dependecies.



来源:https://stackoverflow.com/questions/1872202/cxf-jax-rs-is-causing-busexception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!