WAS7上没有球衣的JAX-RS [英] JAX-RS without jersey on WAS7
问题描述
我已经在WAS 8.0上部署了JAX-RS WS应用程序,其中有一个空的2.4 web.xml,该类扩展了'javax.ws.rs.core.Application'和2个资源,并且效果很好.
I have JAX-RS WS application deployed on WAS 8.0 with an empty 2.4 web.xml, class that extends 'javax.ws.rs.core.Application' and 2 resources, and it works great.
我想在WAS 7.0上部署此应用程序,但是我得到:'错误404:SRVE0190E:找不到文件:/rest/source'(这是资源的路径).
I would like to deploy this application on WAS 7.0, but I'm getting: 'Error 404: SRVE0190E: File not found: /rest/source' (that's the path of the resource).
如何在不使用Jersey或任何其他与应用程序服务器相关的类的情况下在WAS 7.0上部署JAX-RS应用程序?
How can I deploy JAX-RS application on WAS 7.0 without using Jersey or any other application-server related classes?
谢谢
推荐答案
在WAS 7中,您必须在web.xml中定义servlet:
In WAS 7 you must defined the servlet in the web.xml:
<servlet>
<description>JAX-RS Tools Generated - Do not modify</description>
<servlet-name>JAX-RS Servlet</servlet-name>
<servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>YOUR APPLICATION CLASS</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAX-RS Servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
此外,WAS 7不与JAX-RS捆绑在一起,您应该将JAX-RS罐子添加到Web模块中或将其添加为共享库.
Also, WAS 7 isn't bundle with JAX-RS you should add the JAX-RS jars to your web module or add it as a shared library.
这篇关于WAS7上没有球衣的JAX-RS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!