AbstractMethodError che utilizza UriBuilder su JAX-RS

Sto provando a build un webservice REST usando una risposta asincrona.

Ho guardato in giro questo errore sul web, tuttavia, nessuna delle soluzioni ha funzionato per me. Non sono sicuro su come farlo.

Questo è il codice per il servizio REST, ha AsyncResponse e @Suspended che sono presi dal file jar specificato nel pom.xml , che fornirò di seguito. Il problema è che, distribuendo la guerra, ottengo un’eccezione:

 java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:651) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.50 logs 

La mia class è la seguente:

 package com.crudapp; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import javax.annotation.Generated; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; //import javax.ws.rs.core.UriBuilder; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.google.gson.Gson; import com.mysql.jdbc.StringUtils; import dao.User; import dao.UserDAO; import dao.UserDAOImpl; import javax.ws.rs.container.AsyncResponse; import javax.ws.rs.container.Suspended; @Path("/crudpath") public class EntityResource { private final ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/spring.xml"); UserDAO userdao = null; private final int numOfThreads = 10; private final ExecutorService executorService = Executors.newFixedThreadPool(numOfThreads); // userdao.getUsers("118"); //ctx.close(); @GET @Produces("application/json") public Response getTupleFromDBasJSON(@QueryParam("param1") String userid, @Suspended final AsyncResponse asyncresponse ){ if(StringUtils.isNullOrEmpty(userid)) throw new ServiceException("Userid passed to the REST service /crudpath is null or empty"); userdao = (userdao==null)? ctx.getBean("userDAO", UserDAOImpl.class) : userdao; Gson gson = new Gson(); Future<List> futures = executorService.submit(new DAOTaskHandlerThread(userid)); List  users = new ArrayList(); if(futures.isDone()) { try{ users = futures.get(); if(users!= null) return Response.status(200).entity( gson.toJson(users).toString()).build(); } catch(Exception ex) { throw new ServiceException(ex); } } return Response.status(200).entity(new ArrayList().toString()).build(); /*// crrate a new thread.. call the DAO .. returns the result from here. JSONObject jsonObject = new JSONObject(); jsonObject.put("key", "value"); return Response.status(200).entity( jsonObject.toString()).build();*/ } private class DAOTaskHandlerThread implements Callable<List>{ //private UserDAO userDAO; private String userid; private DAOTaskHandlerThread(//UserDAO userDAO, String useridpassed){ ///this.userDAO= userDAO; userid= useridpassed; } @Override public List call() throws Exception { // TODO Auto-generated method stub return userdao.getUsers(userid); } } } 

Il mio file pom.xml per Maven è il seguente:

  4.0.0 RESTJerseyExample RESTJerseyExample 0.0.1-SNAPSHOT war  src   maven-war-plugin 2.4  WebContent false    maven-compiler-plugin 3.1  1.8 1.8       1.7 4.0.3.RELEASE    org.springframework spring-context ${org.springframework-version}   org.springframework spring-webmvc ${org.springframework-version}   org.springframework spring-orm ${org.springframework-version} jar compile    asm asm 3.3.1   com.sun.jersey jersey-bundle 1.19   org.json json 20140107   com.sun.jersey jersey-server 1.19   com.sun.jersey jersey-core 1.19   org.apache.commons commons-dbcp2 2.0    commons-io commons-io 2.4   org.apache.httpcomponents httpclient 4.3.2    javax.ws.rs javax.ws.rs-api 2.0-m12