Uploaded image for project: 'Apache Tomcat Maven Plugin'
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-303

Tomcat 8: Jar classes override project classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 3.0
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rupert@madden-abbott.com Rupert Madden-Abbott
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: