java Tomcat 6 与 7 - lib 与共享/lib - 仅 jars?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17334122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 01:42:33  来源:igfitidea点击:

Tomcat 6 vs 7 - lib vs shared/lib - jars only?

javatomcatclasspathtomcat7classloader

提问by hawkeye

When upgrading from Tomcat 6 to Tomcat 7 - we kept a number of files we wanted on the classpath in the $CATALINA_HOME/lib directory on 6 - and it made sense to move these two $CATALINA_HOME/shared/lib on Tomcat 7.

从 Tomcat 6 升级到 Tomcat 7 时 - 我们在 6 的 $CATALINA_HOME/lib 目录中的类路径上保留了一些我们想要的文件 - 将这两个 $CATALINA_HOME/shared/lib 移动到 Tomcat 7 上是有意义的。

What we've found is that the jar files went across ok - but anything that wasn't a jar file - eg an xml file etc was not picked up by the class loaded in the shared/lib directory. When we moved the non-jar files back to the $CATALINA_HOME/lib directory - they loaded into the classpath without an issue.

我们发现 jar 文件可以通过 - 但是任何不是 jar 文件的东西 - 例如 xml 文件等都没有被加载到 shared/lib 目录中的类所拾取。当我们将非 jar 文件移回 $CATALINA_HOME/lib 目录时 - 它们毫无问题地加载到类路径中。

My question is - is this a bug in the classloader in Tomcat 7? Or is this intended behaviour?(Failing to load non-jar files onto the classpath from the $CATALINA_HOME/shared/lib in a manner inconsistent to that which loads files from $CATALINA_HOME/lib)

我的问题是 - 这是 Tomcat 7 类加载器中的错误吗?或者这是预期的行为?(未能以与从 $CATALINA_HOME/lib 加载文件的方式不一致的方式将非 jar 文件从 $CATALINA_HOME/shared/lib 加载到类路径中)

OS: Windows7

操作系统:Windows7

Tomcat version: 7.0.30

Tomcat 版本:7.0.30

Java version: 1.7.0_11

Java 版本:1.7.0_11

采纳答案by Darius X.

I don't use shared lib, but according to this doc: http://wiki.apache.org/tomcat/HowTo

我不使用共享库,但根据此文档:http: //wiki.apache.org/tomcat/HowTo

Note that Tomcat 6.0.14 the $CATALINA_HOME/shared/lib directory does not exist.

You will need to add this and you will need to edit $CATALINA_HOME/conf/catalina.properties so that the shared.loader line looks like this shared.loader=$CATALINA_HOME/shared/lib

注意Tomcat 6.0.14的$CATALINA_HOME/shared/lib目录不存在。

您需要添加它,并且需要编辑 $CATALINA_HOME/conf/catalina.properties 以便 shared.loader 行看起来像这样 shared.loader=$CATALINA_HOME/shared/lib