I am developing a java application that uses the owl api (v 5.1.19). Everything works fine when I run the app from eclipse.
I need to extract the app as an executable jar file. But when I do so and run the jar file, the owl api throws the following exception. Note that all the dependencies needed by the owl api are extracted in the jar file.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Unknown Source)
at java.base/java.util.Optional.<init>(Unknown Source)
at java.base/java.util.Optional.of(Unknown Source)
at java.base/java.util.stream.FindOps$FindSink$OfRef.get(Unknown Source)
at java.base/java.util.stream.FindOps$FindSink$OfRef.get(Unknown Source)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.findAny(Unknown Source)
at org.semanticweb.owlapi.utilities.Injector.getImplementation(Injector.java:246)
at org.semanticweb.owlapi.apibinding.OWLManager.createOWLOntologyManager(OWLManager.java:119)
at utils.OntologyUtils.loadOntology(OntologyUtils.java:251)
at persistence.OntologyDAO.loadWholeOntology(OntologyDAO.java:31)
at application.OntologyHandler.<init>(OntologyHandler.java:21)
at application.RecommendationAlgorithm.<init>(RecommendationAlgorithm.java:42)
at ui.MainPage.<init>(MainPage.java:37)
at ui.TestUI.main(TestUI.java:9)