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

Executable War fails to run with a NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta-1
    • Fix Version/s: 2.0-beta-1
    • Component/s: tomcat7
    • Labels:
      None
    • Environment:
      Mac OSX (tried on windows 7 as well)

      Description

      Running the package goal with maven with the tomcat7 plugin configured the generated executable war fails to run. The error is:

      $ java -jar ./smapi-1.0-war-exec.jar -debug
      populateWebAppWarPerContext warValue:/smapi-1.0.war|/smapi-1.0
      populateWebAppWarPerContext contextValue/warFileName:/smapi-1.0//smapi-1.0.war
      webappWarPerContext entry key/value: /smapi-1.0//smapi-1.0.war
      Exception in thread "main" java.lang.NullPointerException
      at org.apache.tomcat.maven.runner.Tomcat7Runner.expand(Tomcat7Runner.java:406)
      at org.apache.tomcat.maven.runner.Tomcat7Runner.extract(Tomcat7Runner.java:309)
      at org.apache.tomcat.maven.runner.Tomcat7Runner.run(Tomcat7Runner.java:98)
      at org.apache.tomcat.maven.runner.Tomcat7RunnerCli.main(Tomcat7RunnerCli.java:144)

        Activity

        Hide
        Keith Corbin added a comment -

        That fixed it for me. Thanks so much for your fast resolution. This is an amazing plug-in keep up the good work.

        Show
        Keith Corbin added a comment - That fixed it for me. Thanks so much for your fast resolution. This is an amazing plug-in keep up the good work.
        Hide
        Hudson added a comment -

        Integrated in TomcatMavenPlugin #56 (See https://builds.apache.org/job/TomcatMavenPlugin/56/)
        MTOMCAT-103 Executable War fails to run with a NullPointerException
        do not record jar entry starting with / remove it.

        olamy : http://svn.apache.org/viewvc/?view=rev&rev=1196179
        Files :

        • /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
        • /tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
        Show
        Hudson added a comment - Integrated in TomcatMavenPlugin #56 (See https://builds.apache.org/job/TomcatMavenPlugin/56/ ) MTOMCAT-103 Executable War fails to run with a NullPointerException do not record jar entry starting with / remove it. olamy : http://svn.apache.org/viewvc/?view=rev&rev=1196179 Files : /tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java /tomcat/maven-plugin/trunk/tomcat7-war-runner/src/main/java/org/apache/tomcat/maven/runner/Tomcat7Runner.java
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        should be fixed now. issue with path started with /
        If you still have issues add a comment with stack trace.
        Thanks.

        Show
        Olivier Lamy (*$^¨%`£) added a comment - should be fixed now. issue with path started with / If you still have issues add a comment with stack trace. Thanks.
        Hide
        Keith Corbin added a comment -

        I have unziped the smapi1.0-war-exec.jar file and in it I see the smapi-1.0.war file.
        I think it is finding the war, other wise I would be seeing the zip file exception that I saw when running it from the wrong directory.

        Here is how I have the plugin configured in the pom:
        <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.0-SNAPSHOT</version>
        <executions>
        <execution>
        <id>tomcat-run</id>
        <goals>
        <goal>exec-war-only</goal>
        </goals>
        <phase>package</phase>
        <configuration>
        <path>/smapi-1.0</path>
        </configuration>
        </execution>
        </executions>
        </plugin>

        Show
        Keith Corbin added a comment - I have unziped the smapi1.0-war-exec.jar file and in it I see the smapi-1.0.war file. I think it is finding the war, other wise I would be seeing the zip file exception that I saw when running it from the wrong directory. Here is how I have the plugin configured in the pom: <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.0-SNAPSHOT</version> <executions> <execution> <id>tomcat-run</id> <goals> <goal>exec-war-only</goal> </goals> <phase>package</phase> <configuration> <path>/smapi-1.0</path> </configuration> </execution> </executions> </plugin>
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        does the file smapi-1.0-war-exec.jar contains the war file smapi-1.0.war ?
        As it looks to not be here: how do you configure the mojo in your pom ?

        Show
        Olivier Lamy (*$^¨%`£) added a comment - does the file smapi-1.0-war-exec.jar contains the war file smapi-1.0.war ? As it looks to not be here: how do you configure the mojo in your pom ?

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            Keith Corbin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development