No bean named 'cxf' is defined No bean named 'cxf' is defined spring spring

No bean named 'cxf' is defined


From your error log, I assume you use Spring, if so, you will need to add following lines to your Spring Context XML:

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

Hope this helps.


If someone needs the Spring Java Based Configuration for solving this problem, there are two options:

You can import the cxf.xml file into your Java Config class with:

@ImportResource({ "classpath:META-INF/cxf/cxf.xml" })

Or you can define the bean programatically in your Java Configuration class with:

@Beanpublic SpringBus cxf() {            return new SpringBus();}

CXF + Spring Java Configuration class example.


In case anybody else gets here and is using mulesoft esb. The problem is also present in this system. To fix the issue, add the following section before the definition of the flows.

<spring:beans>    <spring:import resource="classpath:META-INF/cxf/cxf.xml" />    <spring:import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />    <spring:import resource="classpath:META-INF/cxf/cxf-servlet.xml" />    <spring:bean class="org.apache.cxf.bus.spring.Jsr250BeanPostProcessor" />     <spring:bean id="classname" name="classname" class="some.implemented.interface.path" /></spring:beans>