server.xml - Apache Tomcat (CTModelHouse)
File Location: <Tomcat-Installed-Folder>/conf/server.xml
Tomcat maintains a separate namespace of global resources for the entire server. These are configured in the <GlobalNamingResource> element within the server.xml.
The following snippet provides the sample values of the necessary elements and attributes that are to be configured within server.xml for ctmodelhouse:
<GlobalNamingResources> <Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxactive="10" maxidle="10" maxwait="-1" name="jdbc/ModelHouseCT" password="CT_MODEL" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:XE" username="CT_MODEL"/> <Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxactive="10" maxidle="10" maxwait="-1" name="jdbc/ModelHouse" password="CT_MODEL" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:XE" username="CT_MODEL"/> </GlobalNamingResources>
The <user-name> and <password> elements green highlighted in the snippet should match with the database username and password provided for ctmodelhouse.
In case you have installed the Oracle database version 9i, then you should use oracle.jdbc.driver.OracleDriver class for JDBC connections, and for versions above 9i, you should use oracle.jdbc.OracleDriver class.
A Host defines a virtual host under the engine, which can in turn support many contexts (webapps). Tomcat by default includes this host elements in every server.xml file. Make sure that the <Host> element is configured as follows:
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"> </Host>