title: java.util.ServiceLoader not working on WebSphere? no issues on Eclipse
body: <p>I have a Java app (with no main) that runs well on eclipse (I have imported Okta Dependencies using Maven <a href="https://github.com/okta/okta-auth-java" rel="nofollow noreferrer">https://github.com/okta/okta-auth-java</a>), but when uploaded to Tririga ClassLoader, which runs over WebSphere it throws this error:</p>
  
  <pre><code>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 com.okta.commons.lang.Classes$$Lambda$46.000000002B3AE740.get(Unknown Source)
    at java.util.Optional.orElseThrow(Optional.java:301)
    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.&lt;init&gt;(BaseClient.java:72)
  </code></pre>
  
  <p>Of course that I included okta-sdk-httpclient.jar to the ClassPath (and other dependencies).</p>
  
  <p>When debugging the app on Eclipse, on com.okta.commons.lang.Classes, the variable 'return' obtains the value Optional[com.okta.sdk.impl.http.httpclient.HttpClientRequestExecutorFactory@5e955596]; but when running on WebSphere, I assume it is assigned with nothing as .orElseThrow is executed:</p>
  
  <pre><code>public static &lt;T&gt; T loadFromService(Class&lt;T&gt; clazz, String errorMessage) {
          try {
              ServiceLoader&lt;T&gt; serviceLoader = ServiceLoader.load(clazz);
              Optional&lt;T&gt; result = StreamSupport.stream(serviceLoader.spliterator(), false).findFirst();
              return result.orElseThrow(() -&gt; new IllegalStateException(errorMessage));
          } catch(ServiceConfigurationError e) {
              throw new IllegalStateException(errorMessage, e);
          }
      }
  </code></pre>
  
  <p>WebSphere 9.0.5.0 (Latest as of 08-08-2019)
  IBM Java JDK 8.0.5.37 (Latest as of 08-08-2019)
  Tririga 3.6.0.4 (Latest as of 08-08-2019)</p>
  
  <p>Not sure where to look, please help.</p>