Apache CXF RS Extensions issue in 2.4.0

Joe Intrakamhang picture Joe Intrakamhang · Jun 14, 2011 · Viewed 16.8k times · Source

I'm using Apache CXF version 2.4.0. I'm trying to create a Restful service.

The below example works in 2.3.4 but does not work in 2.4.0. What should I do different in beans config file?

When I include the below xml line in my bean config file.

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

I get the following stacktrace error:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml]

Offending resource: ServletContext resource [/WEB-INF/beans.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException:

IOException parsing XML document from class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml]; nested exception is java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml] cannot be opened because it does not exist at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)

My POM dependency is below. This will work for 2.3.4 but not for 2.4.0. Any suggestions? Is that xml extension line deprecated or included in another jar?

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-bundle-jaxrs</artifactId>
        <version>2.3.4</version>
        <exclusions>
            <exclusion>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-server</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

Answer

Daniel Kulp picture Daniel Kulp · Jun 15, 2011

It's no longer needed. With 2.4.x, most of the META-INF/cxf files are no longer needed and can be removed. Really, the cxf.xml one is the only one needed.