Creating application using Java SDK

Hello people, I tried creating an app using the below piece of code:

public class App {

public static void main(String ...args) {
    ClientCredentials clientCredentials = new TokenClientCredentials("004_0lRs-F3WXP9xqAD20feFJIXzv77ZstGoIV_m0V");
    Client client = Clients.builder().setOrgUrl("").setClientCredentials(clientCredentials).build();

    Application application = client.createApplication(client.instantiate(AutoLoginApplication.class)


But then during execution, I get Exception : in thread “main” com.okta.sdk.resource.ResourceException: HTTP 500, Okta E0000009 (Internal Server Error), ErrorId oaeUCHlkhO4SCOfWyXKG9wqWw.

Please advise

Hi @jeyadev

To better understand the use-case, what type of application do you want to create through the SDK?

Hi @dragos

Thank you for the continued support across the questions posted.
I want to create a new application with the sign-on method as OpenID Connect (OAUTH2 client app).
However, the sample provided above was one of the many attempts by me to get any app created via SDK.

Hi @jeyadev

Here is an example to create a native OIDC application

        Application oidc = client.createApplication(client.instantiate(OpenIdConnectApplication.class)
                .setLabel("Test OIDC app")
                                    .setResponseTypes(Arrays.asList(OAuthResponseType.TOKEN, OAuthResponseType.CODE))
                                    .setGrantTypes(Arrays.asList(OAuthGrantType.IMPLICIT, OAuthGrantType.AUTHORIZATION_CODE))

@dragos, awesome!! Thanks a ton!

Meanwhile one last question,

Say we have an error,

com.okta.sdk.resource.ResourceException: HTTP 400, Okta E0000001 (Api validation failed: App Instance), ErrorId oaeKQ3LhZuTSeSDwH-2MJjyjw

Also in some cases, we receive an error stating the number of issues, is there a possibility to understand more about the error log? Thanks again.

Hi @jeyadev

It depends on the response, it can be either an issue with the JSON generated by the SDK or another issue. If you don’t have additional message in the response, please feel free to send an email to and one of our Developer Support Engineers can assist you with additional details regarding the error registered in the logs.

1 Like