I've set up a basic webservice using DropWizard and am attempting to write a client to connect to it. I was following the example in the manual and came up with this:
Client client = ClientBuilder.newClient();
WebTarget webTarget = client.target("
http://localhost:8080");
WebTarget resourceWebTarget = webTarget.path("smallreview");
Invocation.Builder invocationBuilder = resourceWebTarget.request(MediaType.TEXT_PLAIN_TYPE);
Response response = invocationBuilder.get();
System.out.println(response.readEntity(String.class));
This always bombs out with this exception:
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:180)
at org.glassfish.jersey.client.JerseyClient.target(JerseyClient.java:69)
at com.productopia.ds.client.DSClient.getAllReviews(DSClient.java:20)
"DSClient.java:20" is the first WebTarget line in the first snippet.
I've done some Googling and the solutions posted all involve altering your dependencies or else making changes to a web.xml file. There's no web.xml with DropWizard, and I'm not sure how to alter the dependencies without screwing everything up.
Does anyone know a workaround or can point me to a solution?
Thanks, Patrick