java - 是什么导致 FileNotFoundException : . ..pdq.jar 与 db2jcc4?

标签 java jdbc

将 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/

相关文章:

java - 如何从父 Activity 访问 fragment 类中的方法?

java - 使用 Maven 时 org.apache.commons 不存在

java - 使用 Spring Boot 和 Consul 处理 Leader 实例

java - 获取 PathVariable 中的空值

java - 如何在java中的多个线程中生成递归调用和for循环迭代(如果可能)?

java - 准备好的语句和setString

java - 线程在 JDBC Teradata 请求上永久挂起

java - 以下 JDBC/MySQL 查询有什么问题

java - 同时使用 MySQL 和 SQLite

java - 由于 XMI 无法正确加载容器,正在加载序列化的 Ecore 模型