Moving META-INF / context.xml content to tomcat / conf

We are trying to use environment-specific configuration settings from our war files, so we can deploy the same war file on dev / test / prod tomcat servers and not change the contents of the war configuration file.

When I move META-INF / context.xml to connect the database to conf / server.xml, the connection to the database no longer works, with the following error, does anyone know why this would be?

server.xml

<GlobalNamingResources>
    ....
    <Resource
            url="jdbc:oracle:thin:@hostname:1521/something"
            username="username"
            name="jdbc/mydb"
            password="password"
            auth="Container"
            driverClassName="oracle.jdbc.driver.OracleDriver"
            maxActive="5" maxIdle="2" maxWait="10000"
            removeAbandoned="true"
            type="javax.sql.DataSource"
            />
</GlobalNamingResources>

The error is as follows:

INFO: Deploying web application directory ROOT
Problem reading system configuration. Cannot create JDBC driver of class '' for connect URL 'null' (java.io.IOException: Cannot create JDBC driver of class '' for connect URL 'null')
java.io.IOException: Cannot create JDBC driver of class '' for connect URL 'null'
    at au.edu.unimelb.helper.SettingManager.loadSettings(SettingManager.java:212)
    at au.edu.unimelb.helper.SettingManager.<init>(SettingManager.java:53)

(And yes, the odjbc6.jar file is in $ TOMCAT_HOME / lib /)

+1
source share
2 answers

- , tomcat . META-INF/context.xml $TOMCAT_HOME/conf/context.xml, .

+2

context.xml <ResourceLink> ( - META-INF/context.xml, $TOMCAT_HOME/conf/context.xml):

        <ResourceLink name="jdbc/mydb"
              type="javax.sql.DataSource"
              global="jdbc/mydb"/> 
0

All Articles