错误服务Rest Client-Java Rest Client-日食

时间:2018-09-27 23:00:11

标签: java json tomcat8 jersey-client

当前,我在使用JAVA REST JSON服务时遇到错误,它没有启动CoinsalesService服务类,下面的行保留了服务代码,Servlet和Tomcat 8.5日志。

服务客户端

package com.coinsales.sw.rest.services;

    import java.util.List;

    import javax.ws.rs.client.ClientBuilder;
    import javax.ws.rs.client.WebTarget;
    import javax.ws.rs.core.MediaType;

    import com.coinsales.sw.rest.beans.CoinsalesBean;
    import com.coinsales.sw.rest.models.Coinsales;

    public class CoinsalesService {
        private static final String URL_GET_ALL_COINSALE = "http://localhost:8080/CoinSalesWS/apics/ShowAllCoinsales";

        private static WebTarget resource = ClientBuilder.newBuilder().build().target(URL_GET_ALL_COINSALE);

        public static List<Coinsales> fetchCoinsales(int offset, int num) {
            CoinsalesBean res = resource.queryParam("seed", 1)
                    .queryParam("results", num).queryParam("page", 1)
                    .request(MediaType.APPLICATION_JSON).get(CoinsalesBean.class);
            return res.getResults();
        }   


    }

Servlet

private void mostrar(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException , ServletException{

        response.setContentType("text/html;charset=UTF-8");

        List<Coinsales> coinsales = CoinsalesService.fetchCoinsales(0, 50);

        request.setAttribute("coinsales", coinsales);

        request.getRequestDispatcher("/view/coinsales/index.jsp").forward(request, response);

    }

Tomcat 8.5

Sep 27, 2018 5:41:24 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: El Servlet.service() para el servlet [com.coinsales.sw.rest.servlets.CoinsalesServlet] en el contexto con ruta [/CoinSalesSW] lanzó la excepción [La ejecución del Servlet lanzó una excepción] con causa raíz
java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
    at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
    at org.glassfish.jersey.client.JerseyWebTarget.<init>(JerseyWebTarget.java:72)
    at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:344)
    at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:80)
    at com.coinsales.sw.rest.services.CoinsalesService.<clinit>(CoinsalesService.java:16)
    at com.coinsales.sw.rest.servlets.CoinsalesServlet.mostrar(CoinsalesServlet.java:113)
    at com.coinsales.sw.rest.servlets.CoinsalesServlet.doGet(CoinsalesServlet.java:49)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

请支持您的Tomact日志中显示的错误,非常感谢

0 个答案:

没有答案