I cobbled together some Jena TDB code based on stuff I found on the Web. It's basic boilerplate.
In the code below, if the dataset directory does not exist, then everything works well. However, if the dataset exists, then I get an NPE that began life at the call to dataset.getDefaultModel().
Stack trace of the NPE looks like this:
Can someone explain what's causing this? I'm stumped. Oh, Jena version is 2.7.4.
asked 27 Nov '12, 13:33
At a guess, it looks like the previous use of the directory was not shutting the store down properly, leaving the on disk files inconsistent.
What is the rest of the code doing, when the store is new?
answered 28 Nov '12, 04:28
Try starting a transaction before calling:
In other words something like this:
Wrap all of this in a try/catch block with a finally block that closes the dataset to prevent an unclosed dataset from corrupting your db.
answered 10 May '14, 19:30