[ 
https://issues.apache.org/jira/browse/MTOMCAT-119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13550496#comment-13550496
 ] 

Glen Mazza commented on MTOMCAT-119:
------------------------------------

Patch attached.  Note one slight potential drawback, is that now both 
tomcat7:run & tomcat7:run-war will check for the default META-INF/context.xml 
if contextFile is not explicitly configured (and use that file), however 
neither will report anything if that file is not present (as it doesn't need to 
be).  In the past only tomcat7:run-war checks for that file if contextFile is 
not set.

This patch fixes the exception because now if META-INF/context.xml is not 
present (and contextFile not explicitly configured for another file), no file 
is sent to Tomcat and hence the latter will use whatever context defaults it 
uses.  However, if you explicitly configure any file via contextFile that 
doesn't exist Tomcat will continue to throw a File Not Found exception (as it 
should), alerting the developer to the problem.

Unrelated issue fixed, in AbstractRunWarMojo the @Parameter property 
"maven.tomcat.warDirectory" was not defined, making users unable to provide a 
setting via the CLI -Dmaven.tomcat.warDirectory option (although it is defined 
in that class' parent AbstractRunMojo, I've found there's no inheritance of 
individual @Parameter values, just the @Parameter tag itself.)
                
> tomcat7:run-war fails because it expects META-INF\context.xml
> -------------------------------------------------------------
>
>                 Key: MTOMCAT-119
>                 URL: https://issues.apache.org/jira/browse/MTOMCAT-119
>             Project: Apache Tomcat Maven Plugin
>          Issue Type: Bug
>          Components: tomcat7
>    Affects Versions: 2.0-beta-1
>            Reporter: Antelink
>            Assignee: Olivier Lamy (*$^¨%`£)
>             Fix For: 2.1
>
>         Attachments: MTOMCAT119.patch, web_service_tutorial.zip
>
>
> run-war and run-war-only goals fail on tomcat7 plugin, looking for the file 
> =META-INF\context.xml=
> How to reproduce:
> * Use the archetype to create a project
> mvn archetype:generate -DarchetypeGroupId=org.apache.tomcat.maven 
> -DarchetypeArtifactId=tomcat-maven-archetype -DarchetypeVersion=2.0-beta-1
> * Build it
> * cd basic-webapp
> * mvn org.apache.tomcat.maven:tomcat6-maven-plugin:run-war
> => works fine
> * mvn org.apache.tomcat.maven:tomcat7-maven-plugin:run
> => works fine
> * mvn org.apache.tomcat.maven:tomcat7-maven-plugin:run-war
> -> kaboom
> {code}
> [INFO] --- tomcat7-maven-plugin:2.0-beta-1:run-war (default-cli) @ 
> basic-webapp ---
> [INFO] Running war on http://localhost:9090/
> [INFO] Using existing Tomcat server configuration at 
> C:\Users\SAMUEL~1.LAN\AppData\Local\Temp\com.antelink.toto\basic-webapp\target\tomcat
> févr. 16, 2012 6:56:24 PM org.apache.coyote.AbstractProtocol init
> Infos: Initializing ProtocolHandler ["http-bio-9090"]
> févr. 16, 2012 6:56:24 PM org.apache.catalina.core.StandardService 
> startInternal
> Infos: Starting service Tomcat
> févr. 16, 2012 6:56:24 PM org.apache.catalina.core.StandardEngine 
> startInternal
> Infos: Starting Servlet Engine: Apache Tomcat/7.0.25
> févr. 16, 2012 6:56:24 PM org.apache.catalina.startup.ContextConfig 
> processContextConfig
> Grave: Missing context.xml: 
> file:/C:/Users/SAMUEL~1.LAN/AppData/Local/Temp/com.antelink.toto/basic-webapp/target/basic-webapp-1.0-SNAPSHOT/META-INF/context.xml
> java.io.FileNotFoundException: 
> C:\Users\SAMUEL~1.LAN\AppData\Local\Temp\com.antelink.toto\basic-webapp\target\basic-webapp-1.0-SNAPSHOT\META-INF\context.xml
>  (Le fichier spécifié est introuvable)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:138)
>         at java.io.FileInputStream.<init>(FileInputStream.java:97)
>         at 
> sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
>         at 
> sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
>         at java.net.URL.openStream(URL.java:1035)
>         at 
> org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:565)
>         at 
> org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:546)
>         at 
> org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:784)
>         at 
> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:318)
>         at 
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>         at 
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>         at 
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
>         at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
>         at 
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to