Skip to content

Instantly share code, notes, and snippets.

@Karm Karm/context.xml
Created Mar 28, 2018

Embed
What would you like to do?
Narayana transaction manager with Tomcat JDBC connection pool
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Context>
<!-- Narayana resources -->
<Transaction
factory="org.jboss.narayana.tomcat.jta.UserTransactionFactory"
/>
<Resource
factory="org.jboss.narayana.tomcat.jta.TransactionManagerFactory"
name="TransactionManager"
type="javax.transaction.TransactionManager"
/>
<Resource
factory="org.jboss.narayana.tomcat.jta.TransactionSynchronizationRegistryFactory"
name="TransactionSynchronizationRegistry"
type="javax.transaction.TransactionSynchronizationRegistry"
/>
<!-- Database resources -->
<Resource
auth="Container"
databaseName="narayana_db"
description="Data Source"
factory="org.postgresql.xa.PGXADataSourceFactory"
loginTimeout="0"
name="myDataSource"
password="narayana_pass"
portNumber="5432"
serverName="127.0.0.1"
type="org.postgresql.xa.PGXADataSource"
uniqueName="myDataSource"
url="jdbc:postgresql://127.0.0.1:5432/narayana_db"
user="narayana_user"
username="narayana_user"
/>
<Resource
auth="Container"
connectionProperties="POOL_CONNECTIONS=false"
defaultAutoCommit="false"
description="Transactional Driver Data Source"
driverClassName="com.arjuna.ats.jdbc.TransactionalDriver"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
initialSize="10"
jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
jmxEnabled="true"
logAbandoned="true"
maxActive="100"
maxWait="10000"
minEvictableIdleTimeMillis="30000"
minIdle="10"
name="transactionalDataSource"
password="narayana_pass"
removeAbandoned="true"
removeAbandonedTimeout="60"
testOnBorrow="true"
testOnReturn="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="20000"
type="javax.sql.XADataSource"
uniqueName="transactionalDataSource"
url="jdbc:arjuna:java:comp/env/myDataSource"
username="narayana_user"
validationInterval="10000"
validationQuery="SELECT 1"/>
</Context>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.