簡體   English   中英

RESTeasy 3.0.16缺少某些內容(RESTEASY003210)

[英]RESTeasy 3.0.16 missing something (RESTEASY003210)

我將所有這些工作都在一個Web應用程序中工作,而不是與另一個Web應用程序一起工作,並且我一生無法看到有什么區別。

RESTeasy 3.0.16(也嘗試過3.0.13)Tomcat 7.0.67

庫:resteasy-servlet初始化程序,resteasy-jaxrs,resteasy-jackson2-provider

web.xml

<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">

    <display-name>REST Service</display-name>
</web-app>

ServiceApplication.java

@ApplicationPath("/api")
public class ServiceApplication extends Application { }

ServiceInterface.java

public interface ServiceInterface {
     @GET
     @Path("/ping")
     @Produces(MediaType.TEXT_HTML)
     public Response ping();
}

Service.java

public class Service implements ServiceInterface, Serializable {    
    @Override
    public Response ping() {
        return NoCacheResponseBuilder(Response.Status.OK).entity("PING").build();
    }

調用http:// localhost:8080 / webapp / api / ping會導致RESTEASY003210異常。

在發布后(在此上花了3天后...),這並不總是您找到答案的方式嗎?

Service.java錯誤。 它必須是:

@Path("/")
public class Service implements ServiceInterface, Serializable {

    @Override
    public Response ping() {
        return noCacheResponseBuilder(Response.Status.OK).entity("PING").build();
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM