将META-INF/context.xml的内容移动到tomcat/conf [英] Moving contents of META-INF/context.xml to tomcat/conf
问题描述
我们正在尝试从war文件中删除特定于环境的配置设置,因此我们可以将相同的war文件部署到dev/test/prod tomcat服务器中,而不必更改war配置文件的内容.
We are trying to take the environment specific configuration settings out of our war files, so we can deploy the same war file to dev/test/prod tomcat servers and not have to change the contents of the war config file.
将数据库连接的META-INF/context.xml移到conf/server.xml时,数据库连接不再起作用,出现以下错误,有人知道为什么会这样吗?
When I move the META-INF/context.xml for the database connection to the conf/server.xml the database connection no longer works, with the following error, 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>
错误如下:
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)
(是的,odjbc6.jar文件位于$ TOMCAT_HOME/lib/中)
(And yes the odjbc6.jar file is in $TOMCAT_HOME/lib/)
推荐答案
最终解决了问题,tomcat文档略有误导性.您可以将META-INF/context.xml
的内容直接放入$TOMCAT_HOME/conf/context.xml
,它可以正常工作.
Finally worked it out, the tomcat documentation was slightly misleading. You can put the contents of your META-INF/context.xml
straight into $TOMCAT_HOME/conf/context.xml
and it works just fine.
这篇关于将META-INF/context.xml的内容移动到tomcat/conf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!