Okta Java SDK setup on Windows

Trying to get the Java SDK running on my windows desktop. Created this simple application to test my installation:

public class ListOktaApplications {

public static void main(String[] args) {
	Client client = Clients.builder()
			.setClientCredentials(new TokenClientCredentials("api-token-here"))
			.setOrgUrl("https://acme.oktapreview.com").build();

	ApplicationList listApplications = client.listApplications();

	for (Application oktaApp : listApplications) {
		System.out.println(oktaApp.getName());
	}

}

}

Fails to run with the following messages:

[main] WARN com.okta.sdk.impl.ds.DiscriminatorConfig - Could not find config file on the classpath: /com/okta/sdk/resource/discrimination.yaml
Exception in thread “main” java.lang.NullPointerException
at com.okta.sdk.impl.ds.DefaultDiscriminatorRegistry.(DefaultDiscriminatorRegistry.java:35)
at com.okta.sdk.impl.ds.DefaultResourceFactory.(DefaultResourceFactory.java:40)
at com.okta.sdk.impl.ds.DefaultDataStore.(DefaultDataStore.java:105)
at com.okta.sdk.impl.client.AbstractClient.createDataStore(AbstractClient.java:73)
at com.okta.sdk.impl.client.AbstractClient.(AbstractClient.java:68)
at com.okta.sdk.impl.client.DefaultClient.(DefaultClient.java:99)
at com.okta.sdk.impl.client.DefaultClientBuilder.build(DefaultClientBuilder.java:305)
at ListOktaApplications.main(ListOktaApplications.java:14)

Any assistance is appreciated. No idea where this is: /com/okta/sdk/resource/discrimination.yaml

thanks,

Hey @ffridiejr,

What do your dependencies look like? Are you using Maven or Gradle ? Which version of the SDK?
Also how are you running your main class? via a command line or IDE?

Let us know!

Hi,

Using Maven. Have tried on Netbeans and Eclipse, same error. Attempting to run from the IDE. Here is what my dependencies look like.

image

thanks,
Freeman

It looks like you have a missed matched version of okta-sdk (0.10.0, 0.5.0, and 1.0.0). Make sure they are all on the same version and you should be good to go!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.