title: Access JSON Webservice with Java
body: <p>I'm trying to access a webservice (documentation: <a href="http://docs.bittpublic.apiary.io/#reference/public-http-api/ticker/gets-the-current-ticker-data-for-a-given-currency-pair" rel="nofollow">http://docs.bittpublic.apiary.io/#reference/public-http-api/ticker/gets-the-current-ticker-data-for-a-given-currency-pair</a>). I need to take an info from this JSON, the field "volume" from the response. But I'm having problems in the client builder. Check my code/error:</p>
  
  <p>Code:</p>
  
  <pre><code>import javax.ws.rs.client.Client;
  import javax.ws.rs.client.ClientBuilder;
  import javax.ws.rs.client.Entity;
  import javax.ws.rs.core.Response;
  import javax.ws.rs.core.MediaType;
  
  Client client = ClientBuilder.newClient();
  Entity payload = Entity.json("{  'productPair': 'BTCUSD'}");
  Response response = client.target("https://api.bitt.com:8400")
           .path("/ajax/v1/GetTicker")
           .request(MediaType.APPLICATION_JSON_TYPE)
           .post(payload);
  
  System.out.println("status: " + response.toString());
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/util/collection/UnsafeValue
      at java.lang.Class.getDeclaredConstructors0(Native Method)
      at java.lang.Class.privateGetDeclaredConstructors(Class.java:2663)
      at java.lang.Class.getConstructor0(Class.java:3067)
      at java.lang.Class.newInstance(Class.java:408)
      at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:118)
      at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:225)
      at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:86)
      at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114)
      at exchanges.barbados.Bitt.getTicker(Bitt.java:72)
      at exchanges.barbados.Bitt.get24hrVol(Bitt.java:59)
      at exchanges.barbados.Bitt.&lt;init&gt;(Bitt.java:51)
      at main.Main.main(Main.java:363)
  Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.internal.util.collection.UnsafeValue
      at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 12 more
  Java Result: 1
  </code></pre>
  
  <p>I have no idea what is org/glassfish/jersey/internal/util/collection/UnsafeValue and all info I found online was about putting one webservice online, not accesing it.</p>
  
  <p>The jars I added:</p>
  
  <p>javax.ws.rs-api-2.0.1.jar</p>
  
  <p>jersey-client-2.17.jar</p>