Allow the XML/properties replacement engine to WARN when a replacement is not possible (instead of failing)

Description

When starting a Tomcat 7.x server where there are no access logging defined i the server.xml the following exception occurs:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:start (start-container) on project fps: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:start failed: Cannot modify XML file /export/jenkins_home/jobs/FPS-Code-Analysis/workspace/trunk/target/cargo/configurations/tomcat7x/conf/server.xml 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.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79) 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.launchStandard(Launcher.java:329) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239) at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158) at hudson.maven.Maven3Builder.call(Maven3Builder.java:104) at hudson.maven.Maven3Builder.call(Maven3Builder.java:70) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:287) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) 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) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.2.1:start failed: Cannot modify XML file /export/jenkins_home/jobs/FPS-Code-Analysis/workspace/trunk/target/cargo/configurations/tomcat7x/conf/server.xml at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 27 more Caused by: org.codehaus.cargo.util.CargoException: Cannot modify XML file /export/jenkins_home/jobs/FPS-Code-Analysis/workspace/trunk/target/cargo/configurations/tomcat7x/conf/server.xml at org.codehaus.cargo.util.DefaultFileHandler.replaceInXmlFile(DefaultFileHandler.java:463) at org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration.performXmlReplacements(AbstractStandaloneLocalConfiguration.java:124) at org.codehaus.cargo.container.tomcat.Tomcat5xStandaloneLocalConfiguration.performXmlReplacements(Tomcat5xStandaloneLocalConfiguration.java:155) at org.codehaus.cargo.container.tomcat.Tomcat7xStandaloneLocalConfiguration.performXmlReplacements(Tomcat7xStandaloneLocalConfiguration.java:86) at org.codehaus.cargo.container.spi.configuration.AbstractStandaloneLocalConfiguration.configure(AbstractStandaloneLocalConfiguration.java:90) at org.codehaus.cargo.container.spi.configuration.builder.AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder.configure(AbstractStandaloneLocalConfigurationWithXMLConfigurationBuilder.java:123) at org.codehaus.cargo.container.spi.AbstractLocalContainer.start(AbstractLocalContainer.java:159) at org.codehaus.cargo.maven2.AbstractContainerStartMojo.doExecute(AbstractContainerStartMojo.java:61) at org.codehaus.cargo.maven2.ContainerStartMojo.doExecute(ContainerStartMojo.java:52) at org.codehaus.cargo.maven2.AbstractCargoMojo.execute(AbstractCargoMojo.java:311) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) ... 28 more Caused by: org.codehaus.cargo.util.CargoException: Node //Server/Service/Engine/Host/Valve[@className='org.apache.catalina.valves.AccessLogValve'] not found in file /export/jenkins_home/jobs/FPS-Code-Analysis/workspace/trunk/target/cargo/configurations/tomcat7x/conf/server.xml at org.codehaus.cargo.util.DefaultFileHandler.replaceInXmlFile(DefaultFileHandler.java:435) ... 38 more

If server.xml does not contain any AccessLogValve-elements, cargo should not fail to start the server.

Status

Assignee

Savas Ali Tokmen

Reporter

Andreas Bergander

Components

Fix versions

Priority

Major
Configure