我不能使用 WEB-INF/lib 中的子文件夹吗?
Can't I use subfolders in WEB-INF/lib?
我正在 GWT(无 maven)项目中做一些清理工作。它在 WEB-INF/lib 中添加了很多罐子。我知道这些 jar 的用途(例如用于 REST 服务 - 幸运的是它已被记录)所以我想将它们放在适当的子文件夹中以获得更好的外观。
将它们重新添加到构建路径后(因为现在它们在子文件夹中),我尝试 运行 SuperDevMode 并收到多个警告:
Server class 'X' could not be found in the web app, but was found on the system classpath
还有一些错误,例如:
Cannot find a default implementation of the HK2 ServiceLocatorGenerator
当我将这些罐子放回 WEB-INF/lib(没有子文件夹)并重新添加到构建路径时,一切都很好 运行。
我的问题是:t/should我不能使用 WEB-INF/lib 中的子文件夹吗?如果是,为什么?
服务器 class 加载程序被编程为仅查看 WEB-INF/lib,而不查看其他文件夹或子文件夹。
我强烈建议进入 Maven 世界,它有一个陡峭的学习曲线,但它会确保你的项目有一个坚实的基础来发展。 Maven 的另一大优点是它可以自动获取库的最新安全补丁(Equifax,有人吗?)。
Extract from the Apache Tomcat 7 Docs:
WebappX — A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones.
我正在 GWT(无 maven)项目中做一些清理工作。它在 WEB-INF/lib 中添加了很多罐子。我知道这些 jar 的用途(例如用于 REST 服务 - 幸运的是它已被记录)所以我想将它们放在适当的子文件夹中以获得更好的外观。
将它们重新添加到构建路径后(因为现在它们在子文件夹中),我尝试 运行 SuperDevMode 并收到多个警告:
Server class 'X' could not be found in the web app, but was found on the system classpath
还有一些错误,例如:
Cannot find a default implementation of the HK2 ServiceLocatorGenerator
当我将这些罐子放回 WEB-INF/lib(没有子文件夹)并重新添加到构建路径时,一切都很好 运行。
我的问题是:t/should我不能使用 WEB-INF/lib 中的子文件夹吗?如果是,为什么?
服务器 class 加载程序被编程为仅查看 WEB-INF/lib,而不查看其他文件夹或子文件夹。
我强烈建议进入 Maven 世界,它有一个陡峭的学习曲线,但它会确保你的项目有一个坚实的基础来发展。 Maven 的另一大优点是它可以自动获取库的最新安全补丁(Equifax,有人吗?)。
Extract from the Apache Tomcat 7 Docs:
WebappX — A class loader is created for each web application that is deployed in a single Tomcat instance. All unpacked classes and resources in the /WEB-INF/classes directory of your web application, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application, are made visible to this web application, but not to other ones.