org.postgresql.util.PSQLException: Large Objects may not be used in auto-commit mode.

Leave a comment

December 17, 2011 by huionn

I encountered this error yesterday. I thought it is common error and so easy to solve. Unfortunately, all google search results are mostly irrelevant.

After trying many ways in void, finally I look into the source codes of PostgreSQL JDBC.

What does not make sense to me is that although my operation is performed within JTA transaction, postgresql still insists to be in auto-commit=off mode in order to insert the LOB.

After hours of googling + trials an errors, finally I understand what happens – it is due to the subtle mis-configuration of Tomcat resource in nuxeo.xml as shown in https://jira.nuxeo.com/browse/NXP-6985

<Resource name=”jdbc/case-manager” auth=”Container”
    type=”javax.sql.DataSource” maxActive=”100″ maxIdle=”30″ maxWait=”10000″
    factory=”org.nuxeo.runtime.datasource.DataSourceFactory”
    xaDataSource=”org.postgresql.xa.PGXADataSource”
    ServerName=”${nuxeo.db.host}”
    PortNumber=”${nuxeo.db.port}”
    DatabaseName=”${nuxeo.db.name}”
    User=”${nuxeo.db.user}”
    Password=”${nuxeo.db.password}” />

The JTA requires org.postgresql.xa.PGXAConnection which properly sets the autocommit based on context. (Actually I did try to use PGXAConnection, but got no effect because of incorrect configuration also.)

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: