Median Hilal Median Hilal - 5 months ago 52
Java Question

Using Jena with Pellet; NoClassDefFoundError Exception

I'm trying to use Jena 2.12.1 with Pellet; I downloaded the latest Apache Jena library from their site Jena 2.12.1.

First, I downloaded Pellet 2.3.1 and imported the JENA libraries. Unfortunately,

couldn't be resolved, and thus, I couldn't instantiate a reasoner.

Then, I downloaded multiple versions the jar file pellet-jena-2.3.2 (tried 2.3.1 and 2.3.0). This resolved
. However it caused the exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/mindswap/pellet/utils/progress/ProgressMonitor
at org.mindswap.pellet.jena.PelletReasoner.bind(
at org.mindswap.pellet.jena.PelletReasoner.bind(
at com.hp.hpl.jena.rdf.model.ModelFactory.createInfModel(
at code.BasicOWLHandler.main(
Caused by: java.lang.ClassNotFoundException: org.mindswap.pellet.utils.progress.ProgressMonitor

at$ Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more

My code:

import org.mindswap.pellet.jena.PelletReasonerFactory;
import com.hp.hpl.jena.rdf.model.InfModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.reasoner.Reasoner;

public class Test {
public static void main (String [] args)
Reasoner reasoner = PelletReasonerFactory.theInstance().create();

// create an empty model
Model emptyModel = ModelFactory.createDefaultModel( );

// create an inferencing model using Pellet reasoner
InfModel model = ModelFactory.createInfModel( reasoner, emptyModel );

What is the problem? is there a better way to use jena 2.12.1 with Pellet (any version)?


Using pellet-2.3.0 (Aug 22, 2011) including JENA compatible librairies instead of pellet-2.3.1 has solved the problem.