在阅读有关使用 Tomcat 设置 JDBC 的手册/教程时,我经常会遇到对“Tomcat 的 HOME\lib“目录。例如:
Add the driver to your classpath, to your project, or to Tomcat's HOME\lib directory.
其他时候,参考“$CATALINA_HOME/lib“目录。例如:
Before you proceed, don't forget to copy the JDBC Driver's jar into $CATALINA_HOME/lib.
我正在运行 Tomcat 7.0.53 并且知道以下位置:
/usr/share/tomcat7
/var/lib/tomcat7
(webapps/
目录所在位置)/etc/tomcat7
上述位置仅/usr/share/tomcat7
包含一个lib
带有 jar 的目录。这是“Tomcat 的 HOME\lib” 目录?那么,CATALINA_HOME/lib
目录是什么?
答案1
它位于用户/usr/share/tomcat7/lib
文件夹中。如果您已使用apt-get install tomcat7
命令安装容器。
答案2
CATALINA_HOME
并且Tomcat's HOME
通常是相同的:
CATALINA_BASE: /usr/share/tomcat7
CATALINA_HOME: /usr/share/tomcat7
CATALINA_TMPDIR: /usr/share/tomcat7/temp
CATALINA_HOME/lib
因此/usr/share/tomcat7/lib
为确保万无一失,请搜索bootstrap.jar
。此文件位于$CATALINA_HOME/bin/
更多细节这里
答案3
库
$ tree /usr/share/tomcat7
/usr/share/tomcat7
├── bin
│ ├── bootstrap.jar
│ ├── catalina.sh
│ ├── catalina-tasks.xml
│ ├── configtest.sh
│ ├── daemon.sh
│ ├── digest.sh
│ ├── setclasspath.sh
│ ├── shutdown.sh
│ ├── startup.sh
│ ├── tomcat-juli.jar -> ../../java/tomcat-juli.jar
│ ├── tool-wrapper.sh
│ └── version.sh
├── defaults.md5sum
├── defaults.template
├── lib
│ ├── annotations-api.jar -> ../../java/tomcat-annotations-api-7.0.68.jar
│ ├── catalina-ant.jar -> ../../java/catalina-ant-7.0.68.jar
│ ├── catalina-ha.jar -> ../../java/tomcat-catalina-ha-7.0.68.jar
│ ├── catalina.jar -> ../../java/tomcat-catalina-7.0.68.jar
│ ├── catalina-jmx-remote.jar -> ../../java/tomcat-catalina-jmx-remote-7.0.68.jar
│ ├── catalina-tribes.jar -> ../../java/catalina-tribes-7.0.68.jar
│ ├── commons-dbcp.jar -> ../../java/commons-dbcp.jar
│ ├── commons-pool.jar -> ../../java/commons-pool.jar
│ ├── el-api.jar -> ../../java/tomcat-el-api-2.2.jar
│ ├── jasper-el.jar -> ../../java/tomcat-jasper-el-7.0.68.jar
│ ├── jasper.jar -> ../../java/tomcat-jasper-7.0.68.jar
│ ├── jsp-api.jar -> ../../java/tomcat-jsp-api-2.2.jar
│ ├── servlet-api.jar -> ../../java/tomcat-servlet-api-3.0.jar
│ ├── tomcat7-websocket.jar
│ ├── tomcat-api.jar -> ../../java/tomcat-api-7.0.68.jar
│ ├── tomcat-coyote.jar -> ../../java/tomcat-coyote-7.0.68.jar
│ ├── tomcat-i18n-es.jar -> ../../java/tomcat-i18n-es-7.0.68.jar
│ ├── tomcat-i18n-fr.jar -> ../../java/tomcat-i18n-fr-7.0.68.jar
│ ├── tomcat-i18n-ja.jar -> ../../java/tomcat-i18n-ja-7.0.68.jar
│ ├── tomcat-jdbc.jar -> ../../java/tomcat-jdbc-7.0.68.jar
│ ├── tomcat-util.jar -> ../../java/tomcat-util-7.0.68.jar
│ └── websocket-api.jar
├── logrotate.md5sum
└── logrotate.template
2 directories, 38 files
网络应用程序
$ tree /var/lib/tomcat7/
/var/lib/tomcat7/
├── common
│ └── classes
├── conf -> /etc/tomcat7
├── logs -> ../../log/tomcat7
├── server
│ └── classes
├── shared
│ └── classes
├── webapps
│ ├── ROOT
│ │ ├── index.html
│ │ └── META-INF
│ │ └── context.xml
└── work -> ../../cache/tomcat7
和配置
tree /etc/tomcat7/
/etc/tomcat7/
├── Catalina
│ └── localhost
│ ├── docs.xml
│ ├── examples.xml
│ ├── host-manager.xml
│ └── manager.xml
├── catalina.properties
├── context.xml
├── logging.properties
├── policy.d
│ ├── 01system.policy
│ ├── 02debian.policy
│ ├── 03catalina.policy
│ ├── 04webapps.policy
│ ├── 10examples.policy
│ └── 50local.policy
├── server.xml
├── tomcat-users.xml
└── web.xml