Question

public void createDatabase(){
     // Make a TDB-backed dataset
      String directory = "MyDatabases/ex1/" ;
      Dataset dataset = TDBFactory.createDataset(directory) ;

      dataset.begin(ReadWrite.READ) ;
      // Get model inside the transaction
      Model model = dataset.getDefaultModel() ;
      dataset.end() ;

      dataset.begin(ReadWrite.WRITE) ;
      model = dataset.getDefaultModel() ;
      dataset.end() ;
}

I have this very simple piece of code copied directly from the Jena's api webpage (http://jena.apache.org/documentation/tdb/java_api.html) trying to create a database. Getting an error when calling createDataset:

Exception in thread "main" java.lang.IllegalAccessError: tried to access method com.hp.hpl.jena.sparql.core.DatasetImpl.<init>(Lcom/hp/hpl/jena/sparql/core/DatasetGraph;)V from class com.hp.hpl.jena.tdb.TDBFactory
at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:91)
at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:83)
at com.hp.hpl.jena.tdb.TDBFactory.createDataset(TDBFactory.java:79)
Was it helpful?

Solution

There is some java problem - maybe a conflict of versions, or a file access problem with the jar file for jena-arq.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top