Oops Null Pointer

Java programming related

Jackrabbit auto commit exception

At work I have been using a Jackrabbit (JCR) repository in our core product for a quite a few months. Recently we added features for managing financial publications which entails a bunch of CRUD activities using REST including creating versions and performing pessimistic locking.

With add the new activity occurring in the repository we starting seeing occasional auto commit errors. Our JBDC driver (JTDS) reports the following error on commit:

org.apache.jackrabbit.core.state.ItemStateException: commit() should not be called while in auto-commit mode.

Caused by: java.sql.SQLException: commit() should not be called while in auto-commit mode.

Hmmm.. it occurred in some orders of operation (create, edit, finish, find, edit, cancel) but not in others. Also it failed on the build machine and on other dev box, but I earned the “works on my machine” badge.

We use currently use Jackrabbit without a transaction as it turns auto commit on and off itself and thus needs to be unmanaged (see here for a raised issue). I’ve seen hints of using it via XASessions but have not yet found any clear documentation on how to do this.

We also had Jackrabbit using the database to store everything but the Lucene indexes and it shared the same database (SQL Server 2005 / 2008) and database connection as the rest of the application. It was this last point that was causing the issue – giving Jackrabbit it’s own data source to the same database fixed the issue.

The type of data source did not matter – I tried: no-tx-datasource, local-tx-datasource and xa-datasource.

TL;DR: Jackrabbit needs it’s own data source when sharing a SQL Server database.

I’m using:

  • Jackrabbit 2.4.2 (latest stable)
  • JBoss 4.2.3 (old and friendly)
  • SQL Server 2005 / 2008
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: