Apache Tomcat Maven Plugin
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-211

The .war file is not extracted from executable war

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.3
    • Component/s: tomcat7
    • Labels:
      None
    • Environment:
      Windows 7 64bit, Oracle JDK-1.7.0.11, Maven-2.2

      Description

      I create simple web-app project, build it by mvn clean package.

      Than I try to execute the created JAR, but the following exception was thrown:

      java -jar maven-tomcat-test-0.0.1-SNAPSHOT-war-exec.jar
      Exception in thread "main" java.io.FileNotFoundException: .extract\webapps\ctx\test.war (The system cannot find the path specified)
      at java.io.FileOutputStream.open(Native Method)
      at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
      at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
      at org.apache.tomcat.maven.runner.Tomcat7Runner.expand(Tomcat7Runner.java:680)
      at org.apache.tomcat.maven.runner.Tomcat7Runner.extract(Tomcat7Runner.java:555)
      at org.apache.tomcat.maven.runner.Tomcat7Runner.run(Tomcat7Runner.java:200)
      at org.apache.tomcat.maven.runner.Tomcat7RunnerCli.main(Tomcat7RunnerCli.java:204)

      When I look at ".extract\webapps\ctx\" , the folder is empty.

        Activity

        Petr Novak created issue -
        Hide
        Petr Novak added a comment - - edited

        I attached the problematic project.

        Show
        Petr Novak added a comment - - edited I attached the problematic project.
        Petr Novak made changes -
        Field Original Value New Value
        Attachment maven-tomcat-test-0.0.1-SNAPSHOT-war-exec.jar [ 12571463 ]
        Attachment maven-tomcat-test.zip [ 12571464 ]
        Hide
        Petr Novak added a comment -

        I tried some changes in configuration and detect where is the problem.
        The exception is thrown when the project pom.xml file contains the configuration of <path>...</path> and the context (path) has more than one level.
        So <path>/ctx</path> is OK and the JAR could be executed.
        But <path>/ctx/test</path> (2-level path) has problem, the included war-file is not extracted from encapsulating jar.

        Show
        Petr Novak added a comment - I tried some changes in configuration and detect where is the problem. The exception is thrown when the project pom.xml file contains the configuration of <path>...</path> and the context (path) has more than one level. So <path>/ctx</path> is OK and the JAR could be executed. But <path>/ctx/test</path> (2-level path) has problem, the included war-file is not extracted from encapsulating jar.
        Olivier Lamy (*$^¨%`£) made changes -
        Fix Version/s 2.2 [ 12323925 ]
        Olivier Lamy (*$^¨%`£) made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        FAILURE: Integrated in TomcatMavenPlugin-mvn3.x #268 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/268/)
        MTOMCAT-211 The .war file is not extracted from executable war (olamy: http://svn.apache.org/viewvc/?view=rev&rev=1539209)

        • /tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
        Show
        Hudson added a comment - FAILURE: Integrated in TomcatMavenPlugin-mvn3.x #268 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/268/ ) MTOMCAT-211 The .war file is not extracted from executable war (olamy: http://svn.apache.org/viewvc/?view=rev&rev=1539209 ) /tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
        Hide
        Hudson added a comment -

        FAILURE: Integrated in TomcatMavenPlugin-mvn3.x #271 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/271/)
        https://issues.apache.org/jira/browse/MTOMCAT-211
        Followup to r1539920
        Introduce a local variable to cache the object created by expandFile.getParentFile() call. (kkolinko: http://svn.apache.org/viewvc/?view=rev&rev=1539956)

        • /tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
        Show
        Hudson added a comment - FAILURE: Integrated in TomcatMavenPlugin-mvn3.x #271 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/271/ ) https://issues.apache.org/jira/browse/MTOMCAT-211 Followup to r1539920 Introduce a local variable to cache the object created by expandFile.getParentFile() call. (kkolinko: http://svn.apache.org/viewvc/?view=rev&rev=1539956 ) /tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
        Hide
        Alexander Pechersky added a comment -

        I'm still encountering the issue:

        C:\temp\abc>java -jar abc-web-1.14-SNAPSHOT-exec-war.jar -X
        use extractDirectory:.extract
        populateWebAppWarPerContext warValue:abc.war|/abc
        populateWebAppWarPerContext contextValue/warFileName:/abc/abc.war
        webappWarPerContext entry key/value: /abc/abc.war
        expand to file:.extract\webapps\abc.war
        Exception in thread "main" java.lang.Exception: FATAL: impossible to create directories:.extract\webapps
        at org.apache.tomcat.maven.runner.Tomcat7Runner.extract(Tomcat7Runner.java:586)
        at org.apache.tomcat.maven.runner.Tomcat7Runner.run(Tomcat7Runner.java:204)
        at org.apache.tomcat.maven.runner.Tomcat7RunnerCli.main(Tomcat7RunnerCli.java:212)

        Show
        Alexander Pechersky added a comment - I'm still encountering the issue: C:\temp\abc>java -jar abc-web-1.14-SNAPSHOT-exec-war.jar -X use extractDirectory:.extract populateWebAppWarPerContext warValue:abc.war|/abc populateWebAppWarPerContext contextValue/warFileName:/abc/abc.war webappWarPerContext entry key/value: /abc/abc.war expand to file:.extract\webapps\abc.war Exception in thread "main" java.lang.Exception: FATAL: impossible to create directories:.extract\webapps at org.apache.tomcat.maven.runner.Tomcat7Runner.extract(Tomcat7Runner.java:586) at org.apache.tomcat.maven.runner.Tomcat7Runner.run(Tomcat7Runner.java:204) at org.apache.tomcat.maven.runner.Tomcat7RunnerCli.main(Tomcat7RunnerCli.java:212)
        Hide
        Konstantin Kolinko added a comment -

        This has been spotted and fixed during code review a day after tagging 2.2 ("Re: r1539209" thread on dev@)
        The fix will be in 2.3
        http://svn.apache.org/r1539920

        Show
        Konstantin Kolinko added a comment - This has been spotted and fixed during code review a day after tagging 2.2 ("Re: r1539209" thread on dev@) The fix will be in 2.3 http://svn.apache.org/r1539920
        Hide
        Tim Astle added a comment -

        Should the fix version of this issue be updated to 2.3? Or is this issue separate of the one Konstantin Kolinko had mentioned above? (Just seeking clarification on the thread.)

        Show
        Tim Astle added a comment - Should the fix version of this issue be updated to 2.3? Or is this issue separate of the one Konstantin Kolinko had mentioned above? (Just seeking clarification on the thread.)
        Hide
        Alexander Pechersky added a comment -

        It certainly appears to be the same issue. When do you guys plan to release 2.3 ? At the moment, "exec-war" goal in 2.2 is completely unusable because of this problem.

        Show
        Alexander Pechersky added a comment - It certainly appears to be the same issue. When do you guys plan to release 2.3 ? At the moment, "exec-war" goal in 2.2 is completely unusable because of this problem.
        Olivier Lamy (*$^¨%`£) made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Olivier Lamy (*$^¨%`£) made changes -
        Fix Version/s 3.0 [ 12325540 ]
        Fix Version/s 2.2 [ 12323925 ]
        Hide
        Watanabe added a comment -

        me too.
        So, I am using 2.3-SNAPSHOT that run good.
        When to release official version ?

        Show
        Watanabe added a comment - me too. So, I am using 2.3-SNAPSHOT that run good. When to release official version ?
        Dennis Lundberg made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Fix Version/s 2.3 [ 12327452 ]
        Fix Version/s 3.0 [ 12325540 ]
        Resolution Fixed [ 1 ]
        Olivier Lamy (*$^¨%`£) made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Isaac Johnson added a comment -

        Will there be an official 2.3 out soon? We require this fix for our build but cannot depend on SNAPSHOT plugins. Thank you

        Show
        Isaac Johnson added a comment - Will there be an official 2.3 out soon? We require this fix for our build but cannot depend on SNAPSHOT plugins. Thank you

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development