You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Nick Lloyd (JIRA)" <ji...@apache.org> on 2012/08/08 22:04:20 UTC

[jira] [Commented] (MTOMCAT-119) tomcat7:run-war fails because it expects META-INF\context.xml

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

Nick Lloyd commented on MTOMCAT-119:
------------------------------------

The reason for this is actually in org.apache.catalina.startup.ContextConfig processContextConfig implementation for tomcat 7, which is different from tomcat 6.  Digging into that code shows in tomcat 6 some careful "does this file exist?" checks before any xml stream parsing happens.  In tomcat 7 an InputSource is created against the file without checking for the file's existence (which is allowed).  After that an attempt is made to create a stream from that InputSource, which fails, but moving forward from that the method only checks for the presence/absence of the InputSource instance instead of whether or not the stream was created successfully.

Whether this is a bug in tomcat 7 or not I do not know.
                
> 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
>
>
> 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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

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