Moe*_*djo 7 rest spring cxf java-io
我尝试使用CXF 2.6.0和spring 2.5.6开发REST Web服务我的pom.xml中的CXF maven依赖性是:
<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>
Run Code Online (Sandbox Code Playgroud)
我正在使用Spring 2.5.6并且我在applicationcontext.xml spring文件中声明了我的web服务:
<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"/>
Run Code Online (Sandbox Code Playgroud)
我通过以下代码将我的Web服务声明为web.xml文件:
<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>
Run Code Online (Sandbox Code Playgroud)
当我在tomcat上部署我的项目时,我在applicationcontext.xml文件中获得了第二个导入文件的异常:
java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml] cannot be opened because it does not exist
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15698 次 |
| 最近记录: |