DB2 연동간 ibm에서 제공하는 드라이버 db2 jcc 사용시 아래와 같이 pdq.jar FileNotFoundException 이 발생 할 수 있다.
[WARN ] 2020-03-20 10:51:16,388 [localhost-startStop-1][DirectJDKLog.java] log(182) : Failed to scan [file:/C:/Users/aaa/.m2/repository/com/ibm/db2/jcc/db2jcc/db2jcc4/pdq.jar] from classloader hierarchy
java.io.FileNotFoundException: C:\Users\aaa\.m2\repository\com\ibm\db2\jcc\db2jcc\db2jcc4\pdq.jar (지정된 파일을 찾을 수 없습니다)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:130)
at org.apache.tomcat.util.compat.JreCompat.jarFileNewInstance(JreCompat.java:196)
at org.apache.tomcat.util.scan.JarFileUrlJar.<init>(JarFileUrlJar.java:65)
at org.apache.tomcat.util.scan.JarFactory.newInstance(JarFactory.java:49)
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:374)
...
원인은 Optim Development Studio에서만 사용하는 pdq.jar를 해당 드라이버에 추가를 해두어 문제가 되며, tomcat 8.0.38 이후 버전부터는 해당 jar 안에 class scan 을 enabled 하기때문에 문제가 된다.
해당 오류를 다음과 같이 IBM에서는 가이드를 줬다.
java.io.FileNotFoundException thrown by Apache Tomcat application server with IBM Data Server Driver for JDBC and SQLJ
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 Adobe Tomcat, and add an entry like the following one to set the value of scanClassPath to false: <JarScanner scanClassPath=”false” />
tomcat context.xml 파일에 JarScanner scanClassPath=”false” 로 설정 하면 된다고 하는데 Springboot 의 내장 톰캣을 사용시 context.xml 이 존재 하지 않는다.
jar 파일에 대한 scan을 skip 처리 하는것이고 application.yml에서 간단하게 설정 할 수 있다.
tomcat:
additional-tld-skip-patterns:
- "*.jar"
위와 같이 설정하면 정상적으로 skip 처리 된것을 확인 할 수 있을 것이다.