Spring Boot Embedded Tomcat Dependency Throws Exception On Startup

独自空忆成欢 提交于 2019-12-01 07:54:25

I faced with same problem and did some research.

The problem is tomcat TldScanner that searches tld files in jars. It uses StandardJarScanner and according Tomcat Issue 59226 recursively searches jars defined in jar manifest under Class-Path header.

To construct path to dependency found in manifest it appends dependency name to source jar path. It works well for jars in same directory such as lib directory in exploded war or tomcat lib directory, but fail in such cases where classpath constructed from .m2 or .gradle cache:

path from

/Users/bhodgson/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-core/2.2.11/c3f87d654f8d5943cd08592f3f758856544d279a/jaxb-core.jar

concatenated with jaxb-api.jar from manifest and resulting path is invalid

/Users/bhodgson/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-core/2.2.11/c3f87d654f8d5943cd08592f3f758856544d279a/jaxb-api.jar

For example it could happen when you start application from IDE.

Here instructions how to disable manifest scan for JarScanner or filter out jars that you sure not contain tld files: https://stackoverflow.com/a/43280452/5190486

Also this answer contains information about Tomcat JarScanner issues: https://stackoverflow.com/a/43002625/5190486

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!