Uploaded image for project: 'Apache Tomcat Maven Plugin'
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-193

Odd need to create an empty context.xml file for the Apache Tomcat Maven plugin to work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.0
    • None
    • tomcat7
    • None
    • Ubuntu Linux, JDK 7, CXF 2.7.1

    Description

      Hi, I switched from the Codehaus to the Apache Tomcat plugin for Apache CXF's REST archetype:
      http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml?r1=1417501&r2=1418739&diff_format=h

      For "mvn clean install" to work with the new plugin I needed to add an empty META-INF/context.xml file:
      http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/META-INF/

      This file was never needed by the Codehaus plugin. If I didn't add it for the Apache one, "mvn clean install" returns this error:

      [INFO] — maven-surefire-plugin:2.10:test (default-test) @ testrest —
      [INFO] Skipping execution of surefire because it has already been run for this configuration
      [INFO]
      [INFO] — maven-war-plugin:2.1.1:war (default-war) @ testrest —
      [INFO] Packaging webapp
      [INFO] Assembling webapp [testrest] in [/media/work1/opensource/testrest/target/testrest-0.0.1-SNAPSHOT]
      [INFO] Processing war project
      [INFO] Copying webapp resources [/media/work1/opensource/testrest/src/main/webapp]
      [INFO] Webapp assembled in [29 msecs]
      [INFO] Building war: /media/work1/opensource/testrest/target/testrest-0.0.1-SNAPSHOT.war
      [INFO] WEB-INF/web.xml already added, skipping
      [INFO]
      [INFO] <<< tomcat7-maven-plugin:2.0:run-war (start-tomcat) @ testrest <<<
      [INFO]
      [INFO] — tomcat7-maven-plugin:2.0:run-war (start-tomcat) @ testrest —
      [INFO] Running war on http://localhost:56114/jaxrs-service
      [INFO] Creating Tomcat server configuration at /media/work1/opensource/testrest/target/tomcat
      [INFO] create webapp with contextPath: /jaxrs-service
      Dec 08, 2012 2:37:48 PM org.apache.coyote.AbstractProtocol init
      INFO: Initializing ProtocolHandler ["http-bio-56114"]
      Dec 08, 2012 2:37:48 PM org.apache.catalina.core.StandardService startInternal
      INFO: Starting service Tomcat
      Dec 08, 2012 2:37:48 PM org.apache.catalina.core.StandardEngine startInternal
      INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
      Dec 08, 2012 2:37:48 PM org.apache.catalina.startup.ContextConfig processContextConfig
      SEVERE: Missing context.xml: file:/media/work1/opensource/testrest/target/testrest-0.0.1-SNAPSHOT/META-INF/context.xml
      java.io.FileNotFoundException: /media/work1/opensource/testrest/target/testrest-0.0.1-SNAPSHOT/META-INF/context.xml (No such file or directory)
      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:1037)
      at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:618)
      at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:599)
      at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:837)
      at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:387)
      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)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)

      Once I added the context.xml file (with just an empty <context/> element) to the project the new plugin ran fine like the old one.

      Is there something wrong with my archetype's pom (link at the top) requiring me to create this empty context.xml file? If not, then it looks like a bug in the plugin – I shouldn't be required to create an empty META-INF/context.xml file when using this plugin – it should be able to default to whatever defaults it is using with this empty file I'm now providing it.

      Attachments

        Activity

          People

            olamy Olivier Lamy
            gmazza Glen Mazza
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: