Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8993723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:15:22+00:00 2026-06-15T23:15:22+00:00

I am trying to start Tomcat by using maven antrun plugin in a job

  • 0

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.

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.

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.

<plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <executions>
                            <execution>
                                <id>startTomcat</id>
                                <phase>compile</phase>
                                <configuration>

                                    <target>

                                        <exec executable="C:\Windows\System32\cmd.exe" spawn="true">
                                            <arg value="/c" />
                                            <arg value="D:\apache-tomcat-6.0.36\bin\startup.bat" />
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

The is the log I see in jenkins

[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)

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.

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.

I tried the following as well as suggested in the link https://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build That didn’t work either on a Windows 64 bit Windows 7 machine

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:\>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:

<exec executable="SCHTASKS">
    <arg value="/Run"/>
    <arg value="/TN"/>
    <arg value="Tomcat"/>
</exec>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:15:24+00:00Added an answer on June 15, 2026 at 11:15 pm

    Are you sure that tomcat does not start at all? IIRC Jenkins does not support spawning of long living processes of builds (see here).

    Regarding tomcat the second comment might be helpful: starting tomcat as service rather than with shell script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying start java application but in browser i see standard tomcat's page. Server
I'm trying to start a phantomjs process from python but for some reason it's
I am trying to start a new Rails project but I am getting a
I am trying to start service from AsyncTask but cant see that its starts.
I'm building a JAX-RS web service (Jersey) and now I'm trying to start using
I'm using the cloud foundry plugin. I have set my credentials in Config.groovy. Can
When I am trying to run tomcat using startup.bat I get the following error,
I'm trying out atmosphere on tomcat 6 but only long polling works not websockets.
I am trying to create a spring-managed standalone pool for tomcat-dbcp using the version
I was trying to deploy a WAR file using the Cargo Ant task version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.