Search code examples
javastormpath

Error while creating a client using Stormpath Java API


I am trying to create a Stormpath client using the JAVA API. I have got a method as follows:

private void createClient() throws IOException, ReadException {
    StormpathConfiguration config = StormpathBuildClient.getConfiguration();
    InputStream is = new ByteArrayInputStream(getKeyFile(config).getBytes());
    ApiKey apiKey = ApiKeys.builder().setInputStream(is).build();
    Client cpio =  Clients.builder().setApiKey(apiKey).build();
    this.client = cpio;
}

I am getting the error on the second last line and the stacktrace is:

java.lang.RuntimeException: Unable to instantiate DataStore implementation: com.stormpath.sdk.impl.ds.DefaultDataStore
    at com.stormpath.sdk.impl.client.DefaultClient.createDataStore(DefaultClient.java:158)
    at com.stormpath.sdk.impl.client.DefaultClient.<init>(DefaultClient.java:63)
    at com.stormpath.sdk.impl.client.DefaultClientBuilder.build(DefaultClientBuilder.java:67)

Please let me know if you got an ideas on how to fix it.

Thanks.


Solution

  • There was a version conflict with jackson-mapper-asl that resulted in the error. I have a blog article with more details on it here: http://adeydas.com/notes-jackson-version-mismatch-stormpath-sdk-v1-0-beta/. Once I excluded that artifact from being called via the SDK (and in essence didn't override it with another version), it worked.