栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Tomcat和Eclipse的Jersey服务

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Tomcat和Eclipse的Jersey服务

我的解决方案:

  1. 将您从Jersey下载的所有库都添加到Tomcat / lib中,这些库都包含
    /ext
    在Jersey .zip的文件夹中。
  2. /lib
    将位于Jersey zip文件文件夹下的库添加到我的项目的Web-Inf / lib中
  3. 添加到我的项目的Web-Inf / lib中
    javax.ws.rs-api-2.jar
    ,您可以在
    /api
    Jersey的文件夹中找到

这样,我就可以在Jersey上运行Tomcat了。

这是我的web.xml

Jersey 2.0

<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">  <display-name>MyRESTServices</display-name>  <welcome-file-list>    <welcome-file>index.html</welcome-file>    <welcome-file>index.htm</welcome-file>    <welcome-file>index.jsp</welcome-file>    <welcome-file>default.html</welcome-file>    <welcome-file>default.htm</welcome-file>    <welcome-file>default.jsp</welcome-file>  </welcome-file-list>  <servlet>        <servlet-name>Jersey Web Application</servlet-name>        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>        <init-param>  <param-name>jersey.config.server.provider.packages</param-name>  <param-value>com.myservice.services</param-value>        </init-param>        <load-on-startup>1</load-on-startup>    </servlet>    <servlet-mapping>        <servlet-name>Jersey Web Application</servlet-name>        <url-pattern>/rest/*</url-pattern>    </servlet-mapping></web-app>

哪里

com.myservice.services
是我有我的服务包

感谢您的意见!!



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/497006.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号