On 11/03/14 00:26, Joakim Soderberg wrote:
Hi,
I am implemented transaction handling based on Jena TDB 2.11 on Tomcat.
But when initializing the model accordingly:
This code depends on several external definitions.
if( file.exists() ) {
dataset = TDBFactory.createDataset(tdbDirectory)
Does not compile.
dataset.begin(ReadWrite.WRITE);
mRootModel = dataset.getDefaultModel();
try {
dataset.commit();
} catch (Exception ex) {
System.out.println("*** error initilizing dataset: " + ex + "
[DataManager/Initialize] ");
} finally {
dataset.end();
}
} else {
file.mkdir();
}
if( mRootModel == null || mRootModel.isEmpty() ) {
dataset.begin(ReadWrite.WRITE);
loadOntology();
try {
dataset.commit();
If loadOntology() fails for any reason, this code does not clear up the
transaction.
try {
loadOntology();
dataset.commit();
} catch (Exception ex) {
dataset.abort() ;
} finally {
> dataset.end();
> }
} catch (Exception ex) {
System.out.println("*** error loading model: " + ex + "
[DataManager/Initialize]");
} finally {
dataset.end();
}
}
I get the following errors:
Updated default model. Size: 0 [DataManager/Initialize]
The text "Updated default model" isn't in the code above!
2014-03-10 16:02:31,972 ERROR [Log.java:94] : Not active: 1
2014-03-10 16:02:31,982 ERROR [Log.java:94] : **** Not active: 1
2014-03-10 16:02:31,983 ERROR [Log.java:94] : Not active: 1
2014-03-10 16:02:31,984 ERROR [Log.java:94] : **** Not active: 1
Attempt to commit or abort when there is no begin.
2014-03-10 16:02:31,985 ERROR [Log.java:94] : Not active: 1
2014-03-10 16:02:31,985 ERROR [Log.java:94] : **** Not active: 1
2014-03-10 16:02:32,598 ERROR [Log.java:94] : Not active: 1
2014-03-10 16:02:32,599 ERROR [Log.java:94] : **** Not active: 1
2014-03-10 16:02:32,616 WARN [Log.java:78] : Block not recognized: 24576
2014-03-10 16:02:32,622 ERROR [Log.java:94] : Not active: 1
2014-03-10 16:02:32,623 ERROR [Log.java:94] : **** Not active: 1
2014-03-10 16:02:32,632 WARN [Log.java:78] : Block not recognized: 24576
2014-03-10 16:02:32,634 ERROR [Log.java:94] : Not active: 1
2014-03-10 16:02:32,634 ERROR [Log.java:94] : **** Not active: 1
2014-03-10 16:02:32,643 WARN [Log.java:78] : Block not recognized: 24576
Added default model. Size: 443 [DataManager]
2014-03-10 16:02:38,721 WARN [Log.java:78] : Inconsistency:
base.allocOffset() = 55554 : allocOffset = 53904
-------------------------
Does it mean the transaction is not active?
and when committing the model it generates the error:
Inconsistency: base.allocOffset() = 55554 : allocOffset = 53904
I have trouble understand what happens. What does the '1' mean in "Not
active 1"?
Internal Id for the transaction.
and does " Inconsistency: base.allocOffset() = 55554 : allocOffset = 53904"
indicate that TDB did not persist? And What us Block 24576?
Possibly, you have multiple accesses to the DB without proper
transaction control. As it's in tomcat are there multiple http requests?
Hard to tell from the sample above but if loadOntology() breaks, all
sorts of trouble may result.
/Joakim