Details

    • Type: Dependency upgrade Dependency upgrade
    • Status: Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 2.0, 2.1, 2.2
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Maven 3.1, Tomcat8.0RC1, Oracle JDK7u25

      Description

      Please provide initial version of Tomcat8 Maven Plugin.

      I tried the recommendations in http://tomcat.10.x6.nabble.com/Tomcat-8-Tomcat-Maven-Plugin-2-2-Tomcat8-Maven-Plugin-td4995858.html#none

      but the guideline http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/adjust-embedded-tomcat-version.html

      does not work for Tomcat8 .

      The problem is in changed Tomcat 8 API, the maven throws folloving exception:
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:142)
      ... 20 more
      by: java.lang.NoSuchMethodError: org.apache.catalina.startup.Tomcat.setDefaultRealm(Lorg/apache/catalina/Realm;)V
      at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:999)
      at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:514)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
      ... 20 more

      The method setDefaultRealm is deprecated in Tomcat7 and was removed in Tomcat8 as described in documentation:
      http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/startup/Tomcat.html#setDefaultRealm(org.apache.catalina.Realm)

        Activity

        Hide
        Marek Jagielski added a comment -

        Hi,
        In which version do you think to treat this issue or how do you plan to solve it (a new branch?)?
        The solution would largely help to test and integrate a new jsr-356 websocket implementation.
        Marek

        Show
        Marek Jagielski added a comment - Hi, In which version do you think to treat this issue or how do you plan to solve it (a new branch?)? The solution would largely help to test and integrate a new jsr-356 websocket implementation. Marek
        Hide
        Konstantin Kolinko added a comment -

        The problem is in changed Tomcat 8 API, the maven throws folloving exception:
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:142)
        ... 20 more
        by: java.lang.NoSuchMethodError: org.apache.catalina.startup.Tomcat.setDefaultRealm(Lorg/apache/catalina/Realm;)V
        at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:999)
        at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:514)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
        ... 20 more

        The method setDefaultRealm is deprecated in Tomcat7 and was removed in Tomcat8 as described in documentation:

        The method setDefaultRealm was deprecated in r1230777 as part of the changes to fix bug 52443
        http://svn.apache.org/viewvc?view=revision&revision=1230777
        https://issues.apache.org/bugzilla/show_bug.cgi?id=52443

        The alternative to {{embeddedTomcat.setDefaultRealm( memoryRealm ) }} call that should work with both Tomcat 7 and 8 is {{embeddedTomcat.getEngine().setRealm( memoryRealm ) }}.

        (It is a bit of a waste that Tomcat.getEngine() creates a default realm implementation that will be immediately replaced here. It would be possible in avoid creating that object by reintroducing the "setDefaultRealm()" method in Tomcat 8).

        Show
        Konstantin Kolinko added a comment - The problem is in changed Tomcat 8 API, the maven throws folloving exception: at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:142) ... 20 more by: java.lang.NoSuchMethodError: org.apache.catalina.startup.Tomcat.setDefaultRealm(Lorg/apache/catalina/Realm;)V at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:999) at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:514) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) ... 20 more The method setDefaultRealm is deprecated in Tomcat7 and was removed in Tomcat8 as described in documentation: The method setDefaultRealm was deprecated in r1230777 as part of the changes to fix bug 52443 http://svn.apache.org/viewvc?view=revision&revision=1230777 https://issues.apache.org/bugzilla/show_bug.cgi?id=52443 The alternative to {{embeddedTomcat.setDefaultRealm( memoryRealm ) }} call that should work with both Tomcat 7 and 8 is {{embeddedTomcat.getEngine().setRealm( memoryRealm ) }}. (It is a bit of a waste that Tomcat.getEngine() creates a default realm implementation that will be immediately replaced here. It would be possible in avoid creating that object by reintroducing the "setDefaultRealm()" method in Tomcat 8).
        Hide
        Petar Tahchiev added a comment -

        Any news on this one? It's blocking me for more than 6 months now and I can't update to servlet specification 3.1

        Show
        Petar Tahchiev added a comment - Any news on this one? It's blocking me for more than 6 months now and I can't update to servlet specification 3.1
        Hide
        Xavier Dury added a comment -

        Do you think there's any chance of progress on this issue now that Tomcat 8 is considered stable (8.0.9)? Thanks.

        Show
        Xavier Dury added a comment - Do you think there's any chance of progress on this issue now that Tomcat 8 is considered stable (8.0.9)? Thanks.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        Hi,
        I started a branch here https://svn.apache.org/repos/asf/tomcat/maven-plugin/branches/tc8.x/
        This is also available in github if you want to participate with pull requests ( https://github.com/apache/tomcat-maven-plugin )
        ATM I don't have a lot of time for that
        Any help will be appreciate!!

        Show
        Olivier Lamy (*$^¨%`£) added a comment - Hi, I started a branch here https://svn.apache.org/repos/asf/tomcat/maven-plugin/branches/tc8.x/ This is also available in github if you want to participate with pull requests ( https://github.com/apache/tomcat-maven-plugin ) ATM I don't have a lot of time for that Any help will be appreciate!!
        Hide
        Envious Guest added a comment -

        Hi,

        What else exactly is left to do there?

        I got the code from GitHub and ran the build with run-its profile. I see ITs are failing. And now what?.. If I manage to get all them passing, will that be considered as ready-to-release plugin? Just at a shallow glance there is not a lot of work there, and as it is a kind of a blocker for me as well, much like as for Petar, I'm eager to spend time fixing it. However, I will hold off doing so if plugin author advices that a complete overhaul is to be done

        Thanks.

        Show
        Envious Guest added a comment - Hi, What else exactly is left to do there? I got the code from GitHub and ran the build with run-its profile. I see ITs are failing. And now what?.. If I manage to get all them passing, will that be considered as ready-to-release plugin? Just at a shallow glance there is not a lot of work there, and as it is a kind of a blocker for me as well, much like as for Petar, I'm eager to spend time fixing it. However, I will hold off doing so if plugin author advices that a complete overhaul is to be done Thanks.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        There are still some Classloader issues to fix with tomcat8:run

        Show
        Olivier Lamy (*$^¨%`£) added a comment - There are still some Classloader issues to fix with tomcat8:run
        Hide
        Xavier Dury added a comment -

        About the Classloader issue, it seems that classes are not loaded from inside the jar file but as the jar file itself.

        I get an error message like "java.lang.ClassFormatError: Incompatible magic value 1347093252 in class file...", 1347093252 = 0x504B0304 = "PK.." (magic string of a zip file). The normal magic string should be 0xCAFEBABE in java class format.

        Show
        Xavier Dury added a comment - About the Classloader issue, it seems that classes are not loaded from inside the jar file but as the jar file itself. I get an error message like "java.lang.ClassFormatError: Incompatible magic value 1347093252 in class file...", 1347093252 = 0x504B0304 = "PK.." (magic string of a zip file). The normal magic string should be 0xCAFEBABE in java class format.
        Hide
        Xavier Dury added a comment - - edited

        I could fix it by changing 2 things in the RunMojo (in the code that iterates over the jarPaths):

        1. return a JarResource instead of a FileResource
        2. remove the condition "ends with .class", otherwise non-classes resources could not be loaded (*.properties)

        Do you need a PR?

        Show
        Xavier Dury added a comment - - edited I could fix it by changing 2 things in the RunMojo (in the code that iterates over the jarPaths): 1. return a JarResource instead of a FileResource 2. remove the condition "ends with .class", otherwise non-classes resources could not be loaded (*.properties) Do you need a PR?
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        Xavier Dury if you have time for pr I will like that for sure

        Show
        Olivier Lamy (*$^¨%`£) added a comment - Xavier Dury if you have time for pr I will like that for sure
        Hide
        ASF GitHub Bot added a comment -

        GitHub user kalgon opened a pull request:

        https://github.com/apache/tomcat-maven-plugin/pull/7

        MTOMCAT-234 Classloading issues

        this fixes the `java.lang.ClassFormatError` but there is another problem: it seems that the `JarScanner` scans the tomcat-maven-plugin dependencies instead of the webapp ones. The result is that no `web-fragment.xml` or `ServletContainerInitializer` works anymore (and I suspect there should be other consequences as well). I did not have enough time to investigate but I noticed that, at line 202 in `StandardJarScanner`, a classloader is skipped (it wasn't so in Tomcat7)... but I don't know if this could be the cause as I don't know the internals of Tomcat very well. I'll try to make some time next week to dig a bit deeper.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/kalgon/tomcat-maven-plugin tc8.x

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tomcat-maven-plugin/pull/7.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #7


        commit 8e92cb72f9c2629116b54ca2c6cd4957b7ef6496
        Author: kalgon <kalgon@hotmail.com>
        Date: 2014-08-14T10:47:12Z

        MTOMCAT-234 Classloading issues


        Show
        ASF GitHub Bot added a comment - GitHub user kalgon opened a pull request: https://github.com/apache/tomcat-maven-plugin/pull/7 MTOMCAT-234 Classloading issues this fixes the `java.lang.ClassFormatError` but there is another problem: it seems that the `JarScanner` scans the tomcat-maven-plugin dependencies instead of the webapp ones. The result is that no `web-fragment.xml` or `ServletContainerInitializer` works anymore (and I suspect there should be other consequences as well). I did not have enough time to investigate but I noticed that, at line 202 in `StandardJarScanner`, a classloader is skipped (it wasn't so in Tomcat7)... but I don't know if this could be the cause as I don't know the internals of Tomcat very well. I'll try to make some time next week to dig a bit deeper. You can merge this pull request into a Git repository by running: $ git pull https://github.com/kalgon/tomcat-maven-plugin tc8.x Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tomcat-maven-plugin/pull/7.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #7 commit 8e92cb72f9c2629116b54ca2c6cd4957b7ef6496 Author: kalgon <kalgon@hotmail.com> Date: 2014-08-14T10:47:12Z MTOMCAT-234 Classloading issues
        Hide
        ASF GitHub Bot added a comment -

        Github user kalgon closed the pull request at:

        https://github.com/apache/tomcat-maven-plugin/pull/7

        Show
        ASF GitHub Bot added a comment - Github user kalgon closed the pull request at: https://github.com/apache/tomcat-maven-plugin/pull/7
        Hide
        ASF GitHub Bot added a comment -

        GitHub user anenviousguest opened a pull request:

        https://github.com/apache/tomcat-maven-plugin/pull/9

        MTOMCAT-234 (Tomcat8 plugin is now working) + MTOMCAT-274

        Hi,
        Don't know how to split this request into two separate ones. Anyway, I finally got Tomcat 8 plugin passing integration tests.
        One thing: it seems that integration tests start embedded Tomcat with http-nio protocol handler, rather than with http-bio, which means that assertion statements had to be changed accordingly.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/anenviousguest/tomcat-maven-plugin tc8.x

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tomcat-maven-plugin/pull/9.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #9


        commit a2e146c785e7f1c964b5d875c78a0bea034dfc78
        Author: Vladislav Ponomarev <ponomarevvlad@gmail.com>
        Date: 2014-08-15T08:12:52Z

        1. Fix: MTOMCAT-274 (updated maven-war-plugin version).
        2. Fix: access_log.* files excluded from apache-rat-plugin configuration. These are generated during Tomcat run and should not be checked.

        commit 952e3d3f9e0c7d1fcb86cc1594f74ebb3648092e
        Author: Vladislav Ponomarev <ponomarevvlad@gmail.com>
        Date: 2014-08-17T13:26:33Z

        Fix: MTOMCAT-234


        Show
        ASF GitHub Bot added a comment - GitHub user anenviousguest opened a pull request: https://github.com/apache/tomcat-maven-plugin/pull/9 MTOMCAT-234 (Tomcat8 plugin is now working) + MTOMCAT-274 Hi, Don't know how to split this request into two separate ones. Anyway, I finally got Tomcat 8 plugin passing integration tests. One thing: it seems that integration tests start embedded Tomcat with http-nio protocol handler, rather than with http-bio, which means that assertion statements had to be changed accordingly. You can merge this pull request into a Git repository by running: $ git pull https://github.com/anenviousguest/tomcat-maven-plugin tc8.x Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tomcat-maven-plugin/pull/9.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #9 commit a2e146c785e7f1c964b5d875c78a0bea034dfc78 Author: Vladislav Ponomarev <ponomarevvlad@gmail.com> Date: 2014-08-15T08:12:52Z 1. Fix: MTOMCAT-274 (updated maven-war-plugin version). 2. Fix: access_log.* files excluded from apache-rat-plugin configuration. These are generated during Tomcat run and should not be checked. commit 952e3d3f9e0c7d1fcb86cc1594f74ebb3648092e Author: Vladislav Ponomarev <ponomarevvlad@gmail.com> Date: 2014-08-17T13:26:33Z Fix: MTOMCAT-234
        Hide
        Envious Guest added a comment -

        Hi guys,

        Would appreciate if you could take a look at my pool request. I eventually got all integration tests passing.

        Thanks.

        Show
        Envious Guest added a comment - Hi guys, Would appreciate if you could take a look at my pool request. I eventually got all integration tests passing. Thanks.
        Hide
        ASF GitHub Bot added a comment -

        Github user anenviousguest closed the pull request at:

        https://github.com/apache/tomcat-maven-plugin/pull/9

        Show
        ASF GitHub Bot added a comment - Github user anenviousguest closed the pull request at: https://github.com/apache/tomcat-maven-plugin/pull/9
        Hide
        Spase Markovski added a comment -

        When will the tomcat8-maven-plugin be released?

        Show
        Spase Markovski added a comment - When will the tomcat8-maven-plugin be released?
        Hide
        Travis Schneeberger added a comment -

        Any indication of when tomcat 8 will be supported?

        Show
        Travis Schneeberger added a comment - Any indication of when tomcat 8 will be supported?
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        So guys.
        FYI there is a branch available here: http://svn.apache.org/repos/asf/tomcat/maven-plugin/branches/tc8.x/ or in github https://github.com/apache/tomcat-maven-plugin .
        Bad but I don't have the bandwith ATM to fix last issues.
        So ATM, it works except for jsp compilation.
        Logs:

        SEVERE: Servlet.service() for servlet [jsp] in context with path [/multi-config] threw exception [java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.r
        untime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the 
        current class, org/apache/jsp/index_jsp, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, org/apache/jasper/runtime/InstanceManagerFactory
        , have different Class objects for the type .getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager; used in the signature] with root cause
        java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/
        InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/codehaus/plexus/cla
        ssworlds/realm/ClassRealm) for resolved class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type .getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg
        /apache/tomcat/InstanceManager; used in the signature
        

        To reproduce: mvn clean install -Prun-its
        Then see the file: tomcat8-maven-plugin/target/test-classes/tomcat-run-multi-config/log.txt

        So any help/patches/pull request are accepted and will be appreciated
        Cheers

        Show
        Olivier Lamy (*$^¨%`£) added a comment - So guys. FYI there is a branch available here: http://svn.apache.org/repos/asf/tomcat/maven-plugin/branches/tc8.x/ or in github https://github.com/apache/tomcat-maven-plugin . Bad but I don't have the bandwith ATM to fix last issues. So ATM, it works except for jsp compilation. Logs: SEVERE: Servlet.service() for servlet [jsp] in context with path [/multi-config] threw exception [java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.r untime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, org/apache/jasper/runtime/InstanceManagerFactory , have different Class objects for the type .getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager; used in the signature] with root cause java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/ InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/index_jsp, and the class loader (instance of org/codehaus/plexus/cla ssworlds/realm/ClassRealm) for resolved class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type .getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg /apache/tomcat/InstanceManager; used in the signature To reproduce: mvn clean install -Prun-its Then see the file: tomcat8-maven-plugin/target/test-classes/tomcat-run-multi-config/log.txt So any help/patches/pull request are accepted and will be appreciated Cheers

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            Petr Novak
          • Votes:
            28 Vote for this issue
            Watchers:
            31 Start watching this issue

            Dates

            • Created:
              Updated:

              Development