将 db2jcc4.jar 添加到系统类路径时,Tomcat 8.0 在一个没有明显引用我的项目 pdq.jar 的 jar 文件上引发 FileNotFoundException。
我无法在我的系统上的任何地方找到它,也找不到它可能来自哪里,除非通过搜索找到下面的答案。
在这种情况下,我的 CATALINA_HOME 指向 C:\tomcat8.0\apache-tomcat-8.0.41 并且我的项目定义了以下 Maven 依赖项:
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.1</version>
<scope>system</scope>
<systemPath>${env.CATALINA_HOME}/lib/db2jcc4-10.1.jar</systemPath>
</dependency>
最佳答案
这可能发生在较新版本的 Db2 jcc 驱动程序中:
Beginning with version 4.16 of the IBM Data Server Driver for JDBC and SQLJ, which is shipped with Db2 10.5 on Linux, UNIX, or Windows operating systems, the MANIFEST.MF file for db2jcc4.jar contains a reference to pdq.jar.
IBM Support提供 2 个选项:
Resolving the problem To prevent the java.io.FileNotFoundException, you can take one of the following actions:
Edit the MANIFEST.MF file, and remove this line: Class-Path: pdq.jar
Edit the context.xml file for Apache Tomcat, and add an entry like the following one to set the value of scanClassPath to false.
个人比较喜欢第二种方式,具体操作如下:
<Context>
...
<JarScanner scanClassPath="false" />
...
</Context>
关于java - 是什么导致 FileNotFoundException : . ..pdq.jar 与 db2jcc4?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46367851/