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 4239634
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:03:39+00:00 2026-05-21T03:03:39+00:00

I have an ant macro I want to run; <macrodef name=serviceTask> <attribute name=server/> <attribute

  • 0

I have an ant macro I want to run;

<macrodef name="serviceTask">
    <attribute name="server"/>
    <attribute name="operation"/>
    <attribute name="service"/>
    <sequential>
        <echo message="sc \\@{server} @{operation} @{service}"/>
        <exec executable="sc.exe" failonerror="true">
            <arg line="\\@{server} @{operation} @{service}"/>
        </exec>
    </sequential>
</macrodef>

<target name="startTomcat">
    <echo message="Start Tomcat ${service} on ${server}"/>
    <serviceTask server="MyServer" operation="start" service="Tomcat8180"/>
</target>

But I get an RPC error:

startTomcat:
     [echo] Start Tomcat Tomcat8180 on pacdcdtadeva02
     [echo] sc \\pacdcdtadeva02 start Tomcat8180
     [exec] [SC] OpenSCManager FAILED 1722:
     [exec]
     [exec] The RPC server is unavailable.
     [exec]

stopTomcat:
     [echo] Stop Tomcat Service Tomcat8180 on pacdcdtadeva02
     [echo] sc \\pacdcdtadeva02 stop Tomcat8180
     [exec] [SC] OpenSCManager FAILED 1722:
     [exec]
     [exec] The RPC server is unavailable.
     [exec]
     [echo] -------------------------------------------------------------------
     [echo] --- Completed on 02/01/2011 05:11:42 PM
     [echo] -------------------------------------------------------------------

Now when I run this from the command line like

sc \\stage01 start Tomcat8180

the service starts/stops

C:\usr\svn_workspaces\xIVR\agent-ivr>sc \\stage01 start Tomcat8180

SERVICE_NAME: Tomcat8180
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 2  START_PENDING
                                (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x1
        WAIT_HINT          : 0xbb8
        PID                : 11228
        FLAGS              :
  • 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-05-21T03:03:40+00:00Added an answer on May 21, 2026 at 3:03 am

    This may or may not help you, but I had problems with the <exec> task with ant on a windows machine as well, in combination with the <arg line=..> statement. Ant just refused to treat the line of parameters as separate entities with spaces between them and I got weird errors like “unrecognised parameter” when it should have been a valid one.

    My problems disappeared after I exchanged the one <arg line=> with one <arg value=...> for every parameter instead.
    I also had to do it like Raghuram specified, and wrap everything in a shell environment as well.

    Might be worth a try.

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

Sidebar

Related Questions

I have the following ant snippet <macrodef name=webapp.start> <attribute name=name /> <sequential> <!--deploy--> <antcall
I have an Ant script that performs a copy operation using the 'copy' task
We have a CruiseControl server running various AntUnit, MbUnit and NUnit tests via Ant.
I want to use the FTP task in ant, and I have found the
We have inherited an ant build file but now need to deploy to both
I have the problem that an specific step in Ant can only be executed
I'm new to NAnt but have some experience with Ant and CruiseControl. What I
I am using apache ant to generate javadoc for my project. I have a
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I use Ant to build Delphi applications (called from CruiseControl). I want ant to

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.