Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache CXF RS Extensions issue in 2.4.0

Tags:

rest

cxf

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>
like image 528
Joe Intrakamhang Avatar asked Jun 14 '11 20:06

Joe Intrakamhang


2 Answers

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.

like image 57
Daniel Kulp Avatar answered Nov 16 '22 00:11

Daniel Kulp


Here is the CXF information about embedding cxf inside spring in version 2.4 and above. http://cxf.apache.org/docs/embedding-cxf-inside-spring.html

like image 22
mik80 Avatar answered Nov 16 '22 00:11

mik80