Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Firstly, there is no tomcat8 component in JIRA so I'm having to put "Tomcat 8" in the title for these tickets as there is no other way to distinguish them.
When the same class exists in both a jar dependency, and a web application, then Tomcat should load the version in the web application over the version in the jar, as documented here: https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html
However, when executing the "run" goal, it appears that the jar class will get loaded, in favour of any that is compiled with the web application itself.
In particular, this occurs when using Class.forName() which triggers getClassLoaderResources on line 420 of org.apache.tomcat.maven.plugin.tomcat8.run.RunMojo. However, this method will attempt to fetch the resource using a UrlClassLoader which has been configured, on line 356, to only use jar paths.