REST CXF and Spring cxf-extension-jaxrs-binding File not found exception?
Asked Answered
E

4

8

i'm trynig to develop a REST web service using CXF 2.6.0 and spring 2.5.6 my CXF maven dependancy in the pom.xml are :

<dependency>
  <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-rs-extension-providers</artifactId>
  <version>2.6.0</version>
   </dependency>

<dependency>
  <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-rs-extension-search</artifactId>
  <version>2.6.0</version>
</dependency>

I'am using Spring 2.5.6 and i have declared my web service in the applicationcontext.xml spring file :

<jaxrs:server id="restContainer" address="/sav">
    <jaxrs:serviceBeans>
        <ref bean="wssav"/>
    </jaxrs:serviceBeans>
</jaxrs:server>

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

And i have declared my Web service into web.xml file by this code :

<servlet>
    <servlet-name>CXFServlet</servlet-name>

    <servlet-class>
        org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

when i deploy my project on tomcat i got this exception for the second file of import in applicationcontext.xml file :

    java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml] cannot be opened because it does not exist 
Edgar answered 23/5, 2012 at 13:43 Comment(1)
Alternatively, you might check out TomEE Plus which is Tomcat with CXF already integrated (plus some other things). tomee.apache.orgGast
B
12

According to this, this file is no longer required for cxf > 2.4.x.

Bodoni answered 23/5, 2012 at 14:13 Comment(0)
I
1

Try removing the line that imports cxf-extension-jaxrs-binding.xml. The other 2 xml files are in the cxf-X.Y.Z.jar. For me that is cxf-2.7.7.jar.

Ious answered 6/10, 2013 at 7:49 Comment(0)
C
0

The file META-INF/cxf/cxf-extension-jaxrs-binding.xml is available in the below artifact.

<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.2.7</version>
Clearwing answered 11/5, 2017 at 11:20 Comment(0)
W
0

In applicationContext.xml, comment out the below imports works for me in cxf 3.1.10. import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml

Westmoreland answered 7/7, 2017 at 18:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.