Trying (unsuccessfully) to use the Java API Skip to main content
https://support.okta.com/help/answers?id=906f0000000qtfuia0&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Mark AmosMark Amos 

Trying (unsuccessfully) to use the Java API

I've been trying to use a simple Java app to access the Okta API and I've been having a problem. It compiles OK, but when I execute it, I get the exception listed below. It's apparently caused by the AuthApiClient call.

Am I missing something in the attached code, or is this perhaps a Java configuration error?

Any help?

import com.okta.sdk.clients.AuthApiClient;
import com.okta.sdk.framework.ApiClientConfiguration; i
mport com.okta.sdk.models.auth.AuthResult;
import java.io.IOException;
@SuppressWarnings("serial")

class AuthJavaApp {
    public static void main(String args[])
            throws IOException {
        String relayState="";
        ApiClientConfiguration oktaSettings = new     ApiClientConfiguration("https://owenscorning.okta.com", [my API key]);     AuthApiClient authClient = new AuthApiClient(oktaSettings);     AuthResult result = authClient.authenticate([a userID], [a user password], relayState);
    String status = result.getStatus();
    System.out.print(status);
    }
}


Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/type/TypeReference
    at AuthJavaApp.main(Player.java:18)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.type.TypeReference
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 6 more
 
Mark AmosMark Amos
Nevermind.... It was a couple of missing .jar's...