1.新建自己的web工作目录后,初学者一般会去修改server.xml文件来指向该目录。其实不必修改conf/server.xml,只需要新建一个xml(context)文件,放到conf/Catalina/localhost目录下面即可。
例如:
<?xml version="1.0" encoding="UTF-8"?>
<Context
docBase="D:/cms"
reloadable="true"
workDir="D:/cms/work">
</Context>
服务启动时会加载这些文件,如果该目录下没有找到相应文件则会去查找相应war文件下的 meta-inf/context.xml文件
即(引自tomat_doc):
In addition to nesting Context elements inside a Host element, you can also store them:
1. in the individual $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps (安装目录下conf/context.xml文件,所有应用必须加载该文件)
2. in the individual $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host ()
3. in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory
4. if the previous file was not found for this application, in individual file at /META-INF/context.xml inside the application files
更详细内容请见http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html
2.tomcat的角色由conf/tomcat-users.xml配置。
3.tomcat5.x的版本中admin模块默认没有安装,需从网站下载,另外需修改conf/tomcat-users.xml文件,加一个admin角色并提供用户才可以使用admin模块。例如:
<role rolename="admin"/>
<user username="adm" password="tomcat" roles="admin,manager"/>