Okta Java SDK - INSTANCE error

I’m trying get Okta Java SDK running. here is the sample code

public static void main(String a) {
Client client = Clients.builder()
.setOrgUrl(“url”)
.setClientCredentials(new TokenClientCredentials("{token}"))
.build();

boolean isClientReadyStatus = client.isReady(client::listApplications);

System.out.println(isClientReadyStatus);

}

I’m getting the following error -

com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse configuration property [maxConnectionsPerRoute]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse system property [com.okta.sdk.impl.http.httpclient.HttpClientRequestExecutor.connPoolControl.maxPerRoute]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse configuration property [maxConnectionsTotal]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse system property [com.okta.sdk.impl.http.httpclient.HttpClientRequestExecutor.connPoolControl.maxTotal]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse configuration property [validateAfterInactivity]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse system property [com.okta.sdk.impl.http.httpclient.HttpClientRequestExecutor.connPoolControl.validateAfterInactivity]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse configuration property [connectionTimeToLive]
com.okta.commons.http.httpclient.HttpClientRequestExecutor lookupConfigValue
WARNING: Failed to parse system property [com.okta.sdk.impl.http.httpclient.HttpClientRequestExecutor.connPoolControl.timeToLive]
com.okta.commons.http.httpclient.HttpClientRequestExecutor getRequestExecutorParam
WARNING: Failed to read configuration property [connectionTimeToLive: Invalid connection time to live value]. Falling back to default value: 300000
Exception in thread “main” java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:53)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:57)
at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:47)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:83)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:96)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:105)
at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:63)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.(PoolingHttpClientConnectionManager.java:620)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:181)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:165)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:127)
at com.okta.commons.http.httpclient.HttpClientRequestExecutor.(HttpClientRequestExecutor.java:105)
at com.okta.commons.http.httpclient.HttpClientRequestExecutorFactory.create(HttpClientRequestExecutorFactory.java:32)
at com.okta.sdk.impl.client.BaseClient.createRequestExecutor(BaseClient.java:77)
at com.okta.sdk.impl.client.BaseClient.(BaseClient.java:46)
at com.okta.sdk.impl.client.DefaultClient.(DefaultClient.java:143)
at com.okta.sdk.impl.client.DefaultClientBuilder.build(DefaultClientBuilder.java:376)
at com.test.OktaHandlers.main(OktaHandlers.java)

also attached are the dependencies scrren grab

I got this resolved. I had an another httpclient.jar in my path.

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