[ 
http://jira.codehaus.org/browse/MTOMCAT-42?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=203607#action_203607
 ] 

Olivier Lamy commented on MTOMCAT-42:
-------------------------------------

Thanks Pascal !
-:)

> mvn tomcat:run fails on **first** invocation after a clean when using 
> <tomcatWebXml>
> ------------------------------------------------------------------------------------
>
>                 Key: MTOMCAT-42
>                 URL: http://jira.codehaus.org/browse/MTOMCAT-42
>             Project: Maven 2.x Tomcat Plugin
>          Issue Type: Bug
>    Affects Versions: 1.0-beta-1
>         Environment: Ubuntu 9.10, i386, sun jdk 6u16, maven 2.2.1
>            Reporter: Pascal Thivent
>            Assignee: Olivier Lamy
>             Fix For: 1.0
>
>         Attachments: my-webapp.tar.gz
>
>
> When declaring a 
> {code:xml} 
> <plugin>
>   <groupId>org.codehaus.mojo</groupId>
>   <artifactId>tomcat-maven-plugin</artifactId>
>   <version>1.0-beta-1</version>
>   <configuration>                                     
>     <tomcatWebXml>${basedir}/src/main/mock/web.xml</tomcatWebXml>
>   </configuration>
> </plugin>
> {code} 
> When running tomcat:run right after a clean, the build fails as shown below:
> {noformat} 
> $ mvn -e clean tomcat:run
> + Error stacktraces are turned on.
> [INFO] Scanning for projects...
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building my-webapp Maven Webapp
> [INFO]    task-segment: [clean, tomcat:run]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] [clean:clean {execution: default-clean}]
> [INFO] Deleting directory /home/pascal/tmp/my-webapp/target
> [INFO] Preparing tomcat:run
> [INFO] [resources:resources {execution: default-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 0 resource
> [INFO] [compiler:compile {execution: default-compile}]
> [INFO] No sources to compile
> [INFO] [tomcat:run {execution: default-cli}]
> [INFO] Running war on http://localhost:8080/my-webapp
> [INFO] Creating Tomcat server configuration at 
> /home/pascal/tmp/my-webapp/target/tomcat
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Could not create Tomcat configuration
> Embedded error: /home/pascal/tmp/my-webapp/src/test/resources/mock/web.xml
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Could not create 
> Tomcat configuration
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>       at 
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>       at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>       at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>       at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Could not create 
> Tomcat configuration
>       at 
> org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:153)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>       ... 17 more
> Caused by: java.io.FileNotFoundException: 
> /home/pascal/tmp/my-webapp/src/test/resources/mock/web.xml
>       at 
> org.codehaus.mojo.tomcat.AbstractRunMojo.copyFile(AbstractRunMojo.java:326)
>       at 
> org.codehaus.mojo.tomcat.AbstractRunMojo.initConfiguration(AbstractRunMojo.java:273)
>       at 
> org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:143)
>       ... 19 more
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 10 seconds
> [INFO] Finished at: Sat Dec 19 17:26:29 CET 2009
> [INFO] Final Memory: 10M/79M
> [INFO] 
> ------------------------------------------------------------------------
> {noformat} 
> A subsequent invocation of tomcat:run just runs fine:
> {noformat}
> $ mvn -e tomcat:run
> + Error stacktraces are turned on.
> [INFO] Scanning for projects...
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building my-webapp Maven Webapp
> [INFO]    task-segment: [tomcat:run]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Preparing tomcat:run
> [INFO] [resources:resources {execution: default-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 0 resource
> [INFO] [compiler:compile {execution: default-compile}]
> [INFO] No sources to compile
> [INFO] [tomcat:run {execution: default-cli}]
> [INFO] Running war on http://localhost:8080/my-webapp
> [INFO] Using existing Tomcat server configuration at 
> /home/pascal/tmp/my-webapp/target/tomcat
> Dec 19, 2009 5:29:58 PM org.apache.catalina.startup.Embedded start
> INFO: Starting tomcat server
> Dec 19, 2009 5:29:59 PM org.apache.catalina.core.StandardEngine start
> INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
> Dec 19, 2009 5:30:00 PM org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8080
> Dec 19, 2009 5:30:00 PM org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-8080
> {noformat}
> I didn't investigate the issue very deeply but this line in the copyFile() 
> method of AbstractRunMojo.java:
> {code:java} 
> URL fromURL = getClass().getResource( fromPath );
> {code} 
> actually obviously returns a null URL on first run. 
> I don't get why the behavior is not consistent (first run after clean vs 
> subsequent runs) but this sounds like a classloader issue (could it be 
> related to MTOMCAT-25?). If you provide some guidance, I could take a look at 
> it.
> I'm joining a project demonstrating this issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to