[jboss-user] [JCA/JBoss] - datasource from log4j appender

fuzzy333 do-not-reply at jboss.com
Mon Apr 27 11:39:56 EDT 2009


I've got an issue getting connections from a data source from a log4j appender. 
The appender is configured to use the same data source as the application, and when code from a @PreDestroy EJB method writes to log4j, this error occurs in the appender.


  | org.jboss.util.NestedSQLException: 
  | Transaction is not active: tx=TransactionImple < ac, BasicAction: -53efa2b4:11e1:49f5f5da:70 status: ActionStatus.COMMITTED >; 
  | - nested throwable: (javax.resource.ResourceException: 
  | Transaction is not active: tx=TransactionImple < ac, BasicAction: -53efa2b4:11e1:49f5f5da:70 status: ActionStatus.COMMITTED >)
  | at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)
  | at ca.company.foo.log.DSConnectionHandler.getConnection(DSConnectionHandler.java:34)
  | at org.apache.log4j.jdbcplus.JDBCLogger.prepareConnection(JDBCLogger.java:489)
  | at org.apache.log4j.jdbcplus.JDBCLogger.append(JDBCLogger.java:555)
  | at org.apache.log4j.jdbcplus.JDBCAppender.flush_buffer(JDBCAppender.java:887)
  | at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:867)
  | [snip]
  | 

I'm expecting to get a connection back from the data source that I can use in autocommit mode (write the log to the database and return the connection to the pool) 

Here is the data source definition, nothing fancy

  | 	<local-tx-datasource>
  | 		<jndi-name>scnDatasource</jndi-name>
  | 		<connection-url>jdbc:oracle:thin:@cps-test-1:1521:CPSDEV</connection-url>
  | 		<driver-class>oracle.jdbc.OracleDriver</driver-class>
  | 		<user-name>test</user-name>
  | 		<password>test</password>
  | 	</local-tx-datasource>
  | 

Creating a copy of the data source, changing "local-tx-datasource" to "no-tx-datasource" makes the problem go away, but I'd rather use the same data source. I guess there's something I'm missing or not understanding. Are data sources supposed to be shareable like this?

I'm using jboss-5.0.0.GA + jboss-seam-2.1.1.GA

Cheers!

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227060#4227060

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227060



More information about the jboss-user mailing list