Search code examples
javanosuchmethoderrorowl-apihermit

NoSuchMethodError while creating HermiT instance


I'm trying to create an instance of HermiT reasoner, but the console continue to show the exception "noSuchMethodError".

In particular this is the error from the java console:

Caused by: java.lang.NoSuchMethodError: org.semanticweb.owlapi.model.OWLOntologyID.getDefaultDocumentIRI()Ljava/util/Optional;
at org.semanticweb.HermiT.structural.OWLClausification.preprocessAndClausify(OWLClausification.java:77)
at org.semanticweb.HermiT.Reasoner.loadOntology(Reasoner.java:214)
at org.semanticweb.HermiT.Reasoner.<init>(Reasoner.java:205)
at org.semanticweb.HermiT.Reasoner.<init>(Reasoner.java:179)
at org.semanticweb.HermiT.ReasonerFactory.createHermiTOWLReasoner(ReasonerFactory.java:51)
at org.semanticweb.HermiT.ReasonerFactory.createReasoner(ReasonerFactory.java:19)
at org.semanticweb.HermiT.ReasonerFactory.createReasoner(ReasonerFactory.java:15)
at org.processmining.plugins.myminer.knowledge.OWLOntologia.retrieve_property_class(OWLOntologia.java:76)
at org.processmining.plugins.myminer.knowledge.OntologyVisualizer.visualize(OntologyVisualizer.java:39)
... 13 more

I already imported all the dependencies needed by HermiT (version 1.4.3.517) and that's the line where the ReasonerFactory is created:

OWLReasonerFactory reasonerFactory = new ReasonerFactory();

The wrong line is:

OWLReasoner hermit = reasonerFactory.createReasoner(ontology);

as the console said.

I don't understand why the instance can't be created and why the Exception is thrown.


Solution

  • I resolved updating to the latest release of owl-api and hermit, releases were found using maven central repository.