Java Url模式不适用于本地主机Url(没有maven的jersey)

Java Url模式不适用于本地主机Url(没有maven的jersey),java,web.xml,url-pattern,Java,Web.xml,Url Pattern,这是我的web.xml。我已经将url模式设置为rest.iam,使用jersey.com构建了一个web服务。但是在tomcat 6中运行时,我遇到了404错误 Web.xml <?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" xmlns:w

这是我的web.xml。我已经将url模式设置为rest.iam,使用jersey.com构建了一个web服务。但是在tomcat 6中运行时,我遇到了404错误

Web.xml

<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<servlet>
    <servlet-name>jersey-serlvet</servlet-name>
    <servlet-class>
                     com.sun.jersey.spi.container.servlet.ServletContainer
                </servlet-class>

     <init-param>

      <param-name>com.sun.jersey.config.property.packages</param-name>
      <param-value>com.snapshothealthapp1.controller</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
        <servlet-name>jersey-serlvet</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
</web-app>

通过在我的程序中添加以下代码,重新解决了这个问题

return Response.status(201).entity(result).build();
并按照此处的规定重新检查已安装的JAR


我几乎看不到截图中的url。你能在外部键入它吗?在看不到你的url的情况下,你确定tomcat没有使用上下文来运行你的应用程序吗。试着打字http://localhost:8080/[您的应用程序\u上下文\u可能\u您的战争\u名称]/rest/。。。这是我的url。到目前为止,我正确获取tomcat网页。但是添加rest不起作用…@claudio添加我的servlet映射有问题吗?您在类级别获得@Path/customers,然后在方法级别获得@Path/get。你试过网址了吗?我会删除@Path/get。。。
return Response.status(201).entity(result).build();