I am trying to use the log4j2 JDBCAppender in my JEE application in
WebSphere Liberty Profile with a DB2 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? Is this a
configuration problem? Or do I have to keep track of, and deal with, any
transactions that are currently happening?