Wednesday, May 28, 2014

Tomcat Resource Config

For multiple application sharing common resource, instead of defining resource in each context xml can be defined globally to share with all context in same tomcat container.
Pro/Cons: Change @ one place will reflect in all application context
  • Define resource in <tomcat-home>/conf/server.xml
other resources
<Resource name="jdbc/hcentivePHIXDS" global="jdbc/hcentivePHIXDS" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="25" maxWait="10000"
username="username" password="password" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localhost:1521:orcl" factory="org.apache.commons.dbcp.BasicDataSourceFactory" />

  • Define resource link in <tomcat-home>/conf/context.xml
other elements
<ResourceLink type="javax.sql.DataSource"

No comments:

Post a Comment