Note that there are some explanatory texts on larger screens.

plurals
  1. POJenkins not running Catalina.bat via maven-antrun
    primarykey
    data
    text
    <p>I am trying to start Tomcat by using maven antrun plugin in a job in Jenkins. I know I can use cargo for the same but I can't use it. Reason being I want the Tomcat with the application running after the build is over. </p> <p>Here's the scenario - I have Job 1 which checks out a project->Builds it->deploys that on Tomcat. Another job say Job 2 checks out another project->builds and deploys it on an ESB and then runs Integration tests using the Tomcat deployed on Job 1. I need to stop Tomcat once in Job 1 which I am achieving using cargo:stop in the clean phase - then I am planning to start it using maven antrun after compile phase. Then again use cargo to redeploy the new war after package phase. I need to do this so that Tomcat is refreshed for every test build and doesn't suffer from Permgen etc. </p> <p>Anyways problem is my following script runs fine from my command prompt i.e. it starts Tomcat fine and opens up a command window for Startup.bat. But when I try the same in Jenkins it is not getting executed and funny enough it does not complain - simple doesn't start tomcat.</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt; &lt;version&gt;1.7&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;startTomcat&lt;/id&gt; &lt;phase&gt;compile&lt;/phase&gt; &lt;configuration&gt; &lt;target&gt; &lt;exec executable="C:\Windows\System32\cmd.exe" spawn="true"&gt; &lt;arg value="/c" /&gt; &lt;arg value="D:\apache-tomcat-6.0.36\bin\startup.bat" /&gt; &lt;/exec&gt; &lt;/target&gt; &lt;/configuration&gt; &lt;goals&gt; &lt;goal&gt;run&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>The is the log I see in jenkins</p> <pre><code>[INFO] Executing tasks Build sequence for target(s) `main' is [main] Complete build sequence is [main, ] main: [exec] Current OS is Windows 7 [exec] Executing 'C:\Windows\System32\cmd.exe' with arguments: [exec] '/c' [exec] 'D:\apache-tomcat-6.0.36\bin\startup.bat' [exec] [exec] The ' characters around the executable and arguments are [exec] not part of the command. Execute:Java13CommandLauncher: Executing 'C:\Windows\System32\cmd.exe' with arguments: '/c' 'D:\apache-tomcat-6.0.36\bin\startup.bat' The ' characters around the executable and arguments are not part of the command. spawned process java.lang.ProcessImpl@ed11c1 [INFO] Executed tasks mojoSucceeded org.apache.maven.plugins:maven-antrun-plugin:1.7(startTomcat) </code></pre> <p>I have tried both executable="C:\Windows\System32\cmd.exe" as well as executable="cmd.exe" - Same issue i.e. when run from command prompt it works fine but in jenkins this isn't starting tomcat and neither errors out.</p> <p>have checked Jenkins - System Configuration and user.name is NEW-LT7-0064$. Not sure if that helps in any way, but when I run from command prompt the user is my windows logged in user. Also I am running Jenkins as Windows Service with the Local System Account.</p> <p>I tried the following as well as suggested in the link <a href="https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build" rel="nofollow">https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build</a> That didn't work either on a Windows 64 bit Windows 7 machine</p> <pre><code>Another workaraund for Windows XP and later is to shedule permanent task and force running it from the ant script. Once run the command: C:\&gt;SCHTASKS /Create /RU SYSTEM /SC ONSTART /TN Tomcat /TR "C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\startup.bat" Note, that ONSTART can be replaced with ONCE if you do not want to keep Tomcat running. Add the following code to your ant script: &lt;exec executable="SCHTASKS"&gt; &lt;arg value="/Run"/&gt; &lt;arg value="/TN"/&gt; &lt;arg value="Tomcat"/&gt; &lt;/exec&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload