I get the following exception when starting ninja: "java.lang.NoClassDefFoundError: javax/activation/MimeTypeParseException"

Like this:

C:\...>bin\ninja.bat count
Using MIDPOINT_HOME:   "c:\midpoint\home\default"
C:\...>Initializing repository using midpoint home
Unexpected exception occurred (class org.springframework.beans.factory.UnsatisfiedDependencyException), reason: Error creating bean with name 'repositoryFactory': Unsatisfied dependency expressed through field 'prismContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'prismContext' defined in class path resource [ctx-configuration.xml]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.evolveum.midpoint.prism.PrismContext]: Factory method 'createInitializedPrismContext' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/activation/MimeTypeParseException

The problem might be you are using unsupported version of Java, like this:

C:\...>java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

The solution is using the supported one (Java 8), either by setting JAVA_HOME variable (Linux) or by directly editing ninja.bat file (Windows).