Reputation: 727
I am trying to use the log4j2 JDBCAppender in my Java EE application in WebSphere Liberty Profile with a DataSource. I'm wondering, if I have a configuration error, because I am seeing the following error in my log:
Caused by: java.sql.SQLException: DSRA9350E: Operation Connection.commit is not allowed during a global transaction.
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.commit(WSJdbcConnection.java:778)
at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.commitAndClose(JdbcDatabaseManager.java:139)
... 84 more
2014-11-20 20:23:33,663 ERROR An exception occurred processing Appender OneViewPrimaryLogDatabase org.apache.logging.log4j.core.appender.AppenderLoggingException: Failed to commit transaction logging event or flushing buffer.
Here is my log4j config data:
<JDBC name="OneViewPrimaryLogDatabase" tableName="IONEVIEW.LOG">
<DataSource jndiName="jdbc/OneViewPrimaryLogDataSource" />
<Column name="LOGDATE" isEventTimestamp="true" />
<Column name="LOGGER" pattern="%logger" isUnicode="false" />
<Column name="LOGLEVEL" pattern="%level" isUnicode="false" />
<Column name="MESSAGE" pattern="%message" isUnicode="false" />
</JDBC>
And here is my DataSource config from WLP:
<jdbcDriver id="Db2V105JdbcDriver">
<library id="Db2V105JdbcDriverJars">
<fileset dir="C:/IBM/DB2V105/java" includes="db2jcc4.jar db2jcc_license_cisuz.jar"/>
</library>
</jdbcDriver>
<dataSource id="OneViewPrimaryLogDataSource" jdbcDriverRef="Db2V105JdbcDriver" jndiName="jdbc/OneViewPrimaryLogDataSource" type="javax.sql.ConnectionPoolDataSource">
<properties.db2.jcc databaseName="OVHALOGP" password="XXXX" portNumber="60008" user="myuser" serverName="myserver"/>
</dataSource>
Does anyone see anything I might be doing wrong here?
Upvotes: 2
Views: 2049
Reputation: 18020
Remko's hint might be correct, for Liberty to achieve that add transactional="false"
to datasource definition in server.xml
:
<dataSource transactional="false" ...>
Upvotes: 2
Reputation: 36754
Someone resolved this issue by checking "Non-transactional data source" in WAS:
Can you give that a try?
Upvotes: 0