I'm using Jena TDB for loading an RDF dataset and making SPARQL queries against it. I'm using the following maven dependency:
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
<version>3.0.1</version>
</dependency>
And here's the java code where I'm trying to create a TDB dataset:
public void loadDirectory(String outputFile){
Dataset dataset = TDBFactory.createDataset(directoryPath);
Model tdb = dataset.getDefaultModel();
FileManager.get().readModel(tdb, outputFile);
tdb.close();
dataset.close();
LOG.info("RDF dataset loaded to memory");
}
It's failing on the first line of the function: TDBFactory.createDataset( directoryPath ) with the following error message:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.sdw.model.JenaModel.loadDirectory(JenaModel.java:69)
at org.sdw.Main.main(Main.java:75)
Caused by: java.lang.NullPointerException
at org.apache.jena.tdb.sys.EnvTDB.processGlobalSystemProperties(EnvTDB.java:33)
at org.apache.jena.tdb.TDB.init(TDB.java:250)
at org.apache.jena.tdb.sys.InitTDB.start(InitTDB.java:29)
at org.apache.jena.system.JenaSystem.lambda$init$40(JenaSystem.java:114)
at java.util.ArrayList.forEach(ArrayList.java:1249)
at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:179)
at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:156)
at org.apache.jena.system.JenaSystem.init(JenaSystem.java:111)
at org.apache.jena.tdb.TDBFactory.<clinit>(TDBFactory.java:40)
META-INF/services/org.apache.jena.system.JenaSubsystemLifecycle
files have not been merged properly. – Coombs