I’m working on a standalone Java8 program to fetch data from the Okta syslog API using the Okta Java SDK. I’m using Maven to build and have the following in my pom.xml:
<properties>
...
<okta.version>1.5.4</okta.version>
...
</properties>
...
<dependencies>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-api</artifactId>
<version>${okta.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-impl</artifactId>
<version>${okta.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-httpclient</artifactId>
<version>${okta.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
Everything works fine when I run the program from within IntelliJ. However, when I build my jars and run from the command line, I get the following error:
Unable to find a 'com.okta.sdk.impl.http.RequestExecutorFactory' implementation on the classpath. Please ensure you have added the okta-sdk-httpclient.jar file to your runtime classpath.
...
Caused by: java.lang.IllegalStateException: Unable to find a 'com.okta.sdk.impl.http.RequestExecutorFactory' implementation on the classpath. Please ensure you have added the okta-sdk-httpclient.jar file to your runtime classpath.
at com.okta.commons.lang.Classes.lambda$loadFromService$0(Classes.java:205) ~[?:?]
at java.util.Optional.orElseThrow(Optional.java:290) ~[?:1.8.0_241]
at com.okta.commons.lang.Classes.loadFromService(Classes.java:205) ~[?:?]
at com.okta.sdk.impl.client.BaseClient.createRequestExecutor(BaseClient.java:103) ~[?:?]
at com.okta.sdk.impl.client.BaseClient.<init>(BaseClient.java:72) ~[?:?]
at com.okta.sdk.impl.client.AbstractClient.<init>(AbstractClient.java:60) ~[?:?]
at com.okta.sdk.impl.client.DefaultClient.<init>(DefaultClient.java:117) ~[?:?]
at com.okta.sdk.impl.client.DefaultClientBuilder.build(DefaultClientBuilder.java:322) ~[?:?]
... 13 more
Is there something wrong with my pom.xml? Am I missing some critical component?
I tried running my server from the command line with the -verbose:class
option and I can see that the JVM is loading classes from my .jar file. I can see that it’s loading classes from okta-sdk-api
and okta-sdk-impl
but I do not see it loading the classes from okta-sdk-httpclient
even though I know those classes are in the .jar file (because I unzipped it and looked).