During setup "An API incompatability was encountered"

I solved this. Documenting here for posterity.

mvn openmrs-sdk:setup produces this error that is so opaque it would be unbelievable to those unaccustomed to dealing with Maven:

Which database would you like to use?:
1) MySQL 5.6 (requires pre-installed MySQL 5.6)
2) MySQL 5.6 in SDK docker container (requires pre-installed Docker)
3) Existing docker container (requires pre-installed Docker)

Which one do you choose? [1/2/3]: 2
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.921 s
[INFO] Finished at: 2019-08-16T18:15:19-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2:setup (default-cli) on project standalone-pom: Execution default-cli of goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2:setup failed: An API incompatibility was encountered while executing org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2:setup: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.13.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] -----------------------------------------------------
[ERROR] : multiple points
[ERROR] -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

In the process of documenting this error to ask about it in on Talk, I ran java -version and found that the default java was version 11.

Thus, this error indicates that the wrong version of Java is being used. It has nothing to do with your selection of database, despite occurring right after the database selection step.

I changed the active Java version with update-java-alternatives (this is Ubuntu-specific – search for how to change the default Java version for your OS).

1 Like

Thanks @bistenes for sharing the solution! :slight_smile: