pingidentity / scim2

The UnboundID SCIM 2.0 SDK for Java
176 stars 72 forks source link

java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder #149

Closed suvera closed 3 years ago

suvera commented 3 years ago

Java Version: 1.8 scim2 Repo: master

I just downloaded this repo (master) and and tried to execute the code described in the README.md


public class Test {

    public static void main(String[] args) throws Exception {

        Client client = ClientBuilder.newClient();
        WebTarget target = client.target("http://some.url.here");
        ScimService scimService = new ScimService(target);

        System.out.println(scimService.getResourceTypes());
    }
}

Got below error

Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/client/ClientBuilder
    at com.unboundid.scim2.client.Test.main(Test.java:14)
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.client.ClientBuilder
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 1 more

am I missing anything from README.md ?

braveulysses commented 3 years ago

Thanks for reporting this. It looks like the README is missing guidance on including a JAX-RS client library.

You should be able to get your example to work by including the jersey-client and jersey-hk2 dependencies in the <dependencies> section of your pom.xml. For example:

  <dependencies>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>2.28</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
      <version>2.28</version>
    </dependency>
    <dependency>
      <groupId>com.unboundid.product.scim2</groupId>
      <artifactId>scim2-sdk-client</artifactId>
      <version>2.3.6</version>
    </dependency>
  </dependencies>