Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Incomplete
    • Affects Version/s: 2.0-beta-1
    • Fix Version/s: moreinfo
    • Component/s: tomcat7
    • Labels:
    • Environment:

      Description

      Just today on November 3rd, i tried out the tomcat7 maven plugin to try out the executable war.
      Following the configuration from the http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/executable-war-jar.html, here's the output of my tomcat7:exec-war-only -X :

      ... lot of lines removed ...

      org.codehaus.plexus:plexus-archiver:jar:2.0.1:compile, junit:junit:jar:4.9:compile, org.hamcrest:hamcrest-core:jar:1.1:compile, org.codehaus.plexus:plexus-io:jar:2.0.1:compile]
      [DEBUG] (f) project = MavenProject: kam.albert.study:BasicSetup:0.0.1-SNAPSHOT @ C:\Users\albert\workspace\BasicSetup\pom.xml
      [DEBUG] (f) projectArtifact = kam.albert.study:BasicSetup:war:0.0.1-SNAPSHOT
      [DEBUG] (f) remoteRepos = [ id: jvnet-nexus-releases
      url: https://maven.java.net/content/repositories/releases/
      layout: default
      snapshots: [enabled => true, update => daily]
      releases: [enabled => true, update => daily]
      , id: central
      url: http://repo1.maven.org/maven2
      layout: default
      snapshots: [enabled => false, update => daily]
      releases: [enabled => true, update => daily]
      ]
      [DEBUG] (f) serverXml = C:\Users\albert\workspace\BasicSetup\src\main\tomcatconf\server.xml
      [DEBUG] (f) tomcatConfigurationFilesDirectory = C:\Users\albert\workspace\BasicSetup\src\main\tomcatconf
      [DEBUG] – end configuration –
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.827s
      [INFO] Finished at: Thu Nov 03 13:06:40 ICT 2011
      [INFO] Final Memory: 6M/15M
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT:exec-war-only (default-cli) on project BasicSetup: Execution default-cli of goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT:exec-war-only failed. NullPointerException -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT:exec-war-only (default-cli) on project BasicSetup: Execution default-cli of goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT:exec-war-only failed.
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT:exec-war-only failed.
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      ... 19 more
      Caused by: java.lang.NullPointerException
      at java.io.FileInputStream.<init>(FileInputStream.java:134)
      at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractExecWarMojo.execute(AbstractExecWarMojo.java:287)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      ... 20 more
      [ERROR]
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

      The full message can be found at http://pastebin.com/yreULuvY

      And my pom :

      <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0-SNAPSHOT</version>
      <executions>
      <execution>
      <id>tomcat7-run</id>
      <goals>
      <goal>exec-war-only</goal>
      </goals>
      <phase>package</phase>
      <configuration>
      <path>/</path>
      <tomcatConfigurationFilesDirectory>src/main/webapp/WEB-INF</tomcatConfigurationFilesDirectory>
      </configuration>
      </execution>
      </executions>
      </plugin>

      The full pom can be found at : http://pastebin.com/6y2nPVBK

      From my test, the package phase doesnt seem to trigger the exec-war-only goal in my "mvn package" execution.
      And in my "mvn tomcat7:exec-war-only", it doesnt seem to read my tomcatConfigurationFilesDirectory property.

      Perhaps im missing something ?

      Thanks !

        Activity

        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        It looks the war generated by your project is not generated.
        Does your project produce a war file ?
        To trigger exec-war-only goal in the package phase, your execution block must be in build/plugins/plugin rather than in pluginManagement section.

        Show
        Olivier Lamy (*$^¨%`£) added a comment - It looks the war generated by your project is not generated. Does your project produce a war file ? To trigger exec-war-only goal in the package phase, your execution block must be in build/plugins/plugin rather than in pluginManagement section.
        Hide
        albert kam added a comment -

        Aha, i see !
        Yes, it's just like you said, now the the goal is triggered when doing the package phase.
        Thank you !

        This should be another question, but still i got error when trying to run it with java -jar mywar.jar -httpPort 8080
        Caused by: com.sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/localhost/PrimefacesSetup/WEB-INF/faces-config.xml': jndi:/localhost/PrimefacesSetup/WEB-INF/faces-config.xml
        at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:920)
        at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:865)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:656)
        ... 10 more
        Caused by: java.io.FileNotFoundException: jndi:/localhost/PrimefacesSetup/WEB-INF/faces-config.xml
        at org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnectio
        n.java:385)
        at com.sun.faces.config.ConfigManager$ParseTask.getInputStream(ConfigManager.java:1106)
        at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:941)
        at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:911)
        ... 14 more

        Strange that it's looking in the naming, since i got the file in here (i check the file's existence after extracting the executable war)
        C:\Users\albert\workspace\PrimefacesSetup\target\PrimefacesSetup-0.0.1-SNAPSHOT-war-exec\PrimefacesSetup\WEB-INF\faces-config.xml
        And yup, it works fine in tomcat7:run ..

        Out of topic question :
        Do you have a mailing list or a group or forum where i can ask questions ?
        I feel bad about making issues without first discussing it. =)

        Show
        albert kam added a comment - Aha, i see ! Yes, it's just like you said, now the the goal is triggered when doing the package phase. Thank you ! This should be another question, but still i got error when trying to run it with java -jar mywar.jar -httpPort 8080 Caused by: com.sun.faces.config.ConfigurationException: Unable to parse document 'jndi:/localhost/PrimefacesSetup/WEB-INF/faces-config.xml': jndi:/localhost/PrimefacesSetup/WEB-INF/faces-config.xml at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:920) at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:865) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:656) ... 10 more Caused by: java.io.FileNotFoundException: jndi:/localhost/PrimefacesSetup/WEB-INF/faces-config.xml at org.apache.naming.resources.DirContextURLConnection.getInputStream(DirContextURLConnectio n.java:385) at com.sun.faces.config.ConfigManager$ParseTask.getInputStream(ConfigManager.java:1106) at com.sun.faces.config.ConfigManager$ParseTask.getDocument(ConfigManager.java:941) at com.sun.faces.config.ConfigManager$ParseTask.call(ConfigManager.java:911) ... 14 more Strange that it's looking in the naming, since i got the file in here (i check the file's existence after extracting the executable war) C:\Users\albert\workspace\PrimefacesSetup\target\PrimefacesSetup-0.0.1-SNAPSHOT-war-exec\PrimefacesSetup\WEB-INF\faces-config.xml And yup, it works fine in tomcat7:run .. Out of topic question : Do you have a mailing list or a group or forum where i can ask questions ? I feel bad about making issues without first discussing it. =)
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        see http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/mail-lists.html
        Can I have a sample application to reproduce that ?

        Show
        Olivier Lamy (*$^¨%`£) added a comment - see http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/mail-lists.html Can I have a sample application to reproduce that ?
        Hide
        albert kam added a comment - - edited

        Here is the simple app attachment, whose executable war runs wrongly, with the error of java.io.FileNotFoundException: jndi:/localhost/BasicSetup/WEB-INF/faces-config.xml

        Show
        albert kam added a comment - - edited Here is the simple app attachment, whose executable war runs wrongly, with the error of java.io.FileNotFoundException: jndi:/localhost/BasicSetup/WEB-INF/faces-config.xml
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        can you try with enabling naming:

        <enableNaming>true</enableNaming>
        
        Show
        Olivier Lamy (*$^¨%`£) added a comment - can you try with enabling naming: <enableNaming> true </enableNaming>
        Hide
        albert kam added a comment -

        Thanks for the fast response !

        I added that in the plugin configuration, still the same FNFE. And then i tried experimenting the 'useNaming', setting both of the config to true and false, but still the same FNFE.

        Just a wild guess from googling around if this has something to do with the classloader classpath where it couldnt see the content of the war that has the WEB-INF/faces-config.xml ?

        Show
        albert kam added a comment - Thanks for the fast response ! I added that in the plugin configuration, still the same FNFE. And then i tried experimenting the 'useNaming', setting both of the config to true and false, but still the same FNFE. Just a wild guess from googling around if this has something to do with the classloader classpath where it couldnt see the content of the war that has the WEB-INF/faces-config.xml ?
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        any way you provide a sample project to reproduce that ?
        BTW some changes has been applied could you retry if you still have the issues ?

        Show
        Olivier Lamy (*$^¨%`£) added a comment - any way you provide a sample project to reproduce that ? BTW some changes has been applied could you retry if you still have the issues ?
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        please provide more infos.

        Show
        Olivier Lamy (*$^¨%`£) added a comment - please provide more infos.

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            albert kam
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 0.05h
              0.05h
              Remaining:
              Remaining Estimate - 0.05h
              0.05h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development