Search code examples
javaontologyowl-api

java.lang.NoClassDefFoundError: dk/brics/automaton/BasicAutomata Execption


I'm using owlapi to return the individuals of a given class. while testing the code using pizza ontology it works perfectly but when i test it on my ontology the following exception apear :

Exception in thread "main" java.lang.NoClassDefFoundError: dk/brics/automaton/BasicAutomata
    at org.semanticweb.HermiT.datatypes.rdfplainliteral.RDFPlainLiteralPatternValueSpaceSubset.<clinit>(RDFPlainLiteralPatternValueSpaceSubset.java:49)
    at org.semanticweb.HermiT.datatypes.rdfplainliteral.RDFPlainLiteralDatatypeHandler.registerPatternDatatype(RDFPlainLiteralDatatypeHandler.java:53)
    at org.semanticweb.HermiT.datatypes.rdfplainliteral.RDFPlainLiteralDatatypeHandler.<clinit>(RDFPlainLiteralDatatypeHandler.java:45)
    at org.semanticweb.HermiT.datatypes.DatatypeRegistry.<clinit>(DatatypeRegistry.java:44)
    at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.visit(OWLClausification.java:744)
    at org.semanticweb.owlapi.model.OWLDatatype.accept(OWLDatatype.java:141)
    at org.semanticweb.HermiT.structural.OWLClausification$DataRangeConverter.convertDataRange(OWLClausification.java:730)
    at org.semanticweb.HermiT.structural.OWLClausification$NormalizedAxiomClausifier.visit(OWLClausification.java:574)
    at org.semanticweb.owlapi.model.OWLDataAllValuesFrom.accept(OWLDataAllValuesFrom.java:52)
    at org.semanticweb.HermiT.structural.OWLClausification.clausify(OWLClausification.java:162)
    at org.semanticweb.HermiT.structural.OWLClausification.preprocessAndClausify(OWLClausification.java:92)
    at org.semanticweb.HermiT.Reasoner.loadOntology(Reasoner.java:210)
    at org.semanticweb.HermiT.Reasoner.<init>(Reasoner.java:201)
    at org.semanticweb.HermiT.Reasoner.<init>(Reasoner.java:175)
    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 Main.main(Main.java:40)
Caused by: java.lang.ClassNotFoundException: dk.brics.automaton.BasicAutomata
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 18 more

I noticed that the problem is due to dataproperties that i'm using in my ontology. (when i delete all the dataproperties it works but when i add them the error appear again)


Solution

  • You should add the dependency in pom.xml in your project :

    First:

    Add the following dependency into pom.xml in your project.

    <dependency>
        <groupId>dk.brics.automaton</groupId>
        <artifactId>automaton</artifactId>
        <version>1.11-8</version>
    </dependency>
    

    Second:

    execute mvn package in the root of your project