Announcement Announcement Module
Collapse
No announcement yet.
Tomcat shutdown.bat from ant? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tomcat shutdown.bat from ant?

    Hi.

    In the airline sample app, there are several useful-looking ant/tomcat commands, with which you can deploy your app to tomcat from ant. One that I can't find, though, is a shutdown target.

    This tomcat-launch target works for me (again, taken from the airline sample):
    Code:
    <target name="tomcat-launch" depends="tomcat.init" description="Launch the tomcat server process">
    		<exec dir="${tomcat.dir}/bin" executable="startup.bat" spawn="true" vmlauncher="false">
    			<env key="JAVA_OPTS" value="${tomcat.javaopts}" />
    		</exec>
    </target>
    This tomcat-shutdown target, that I wrote returns a "BUILD SUCCESSFUL", but doesn't shutdown tomcat:

    Code:
    <target name="tomcat-shutdown" depends="tomcat.init" description="Shutdown the tomcat server process">
    		<exec dir="${tomcat.dir}/bin" executable="shutdown.bat" spawn="true" vmlauncher="false">
    			<env key="JAVA_OPTS" value="${tomcat.javaopts}" />
    		</exec>
    </target>
    Anyone know why not, and what I need to do to get it to work?

    I've googled around on this a bit, but haven't found anything signif yet.

    Ben

  • #2
    Originally posted by benethridge
    what I need to do to get it to work?
    Ditch Redmond?
    Here what I am running on Fedora and no problemo!
    Code:
    <target name="tomcat.stop">
    		<exec dir="${tomcat.home}/bin" executable="shutdown.sh" spawn="true" />
    	</target>
    Finita!

    Comment


    • #3
      Yes, that's pretty much what I had. For some reason (you see it?) it didn't work for me. Here's one I found on google and modified, that does work:
      Code:
      <target name="tomcat-shutdown">
      	<java classname="org.apache.catalina.startup.Bootstrap" fork="yes">
      	<jvmarg value="-Dcatalina.home=${tomcat.dir}" />
      	  <arg value="stop" />
      	   <classpath>
      	     <fileset dir="${tomcat.dir}">
      	       <include name="bin/bootstrap.jar" />
      	     </fileset>
      	   </classpath>
      	 </java>
      </target>
      Ben

      Comment


      • #4
        Oh man...
        3 lines of code against how many lines?
        I do not know what's going on with your Windoz. Mine Linux is just fine with 3 LOC.
        Sorry friend ;(

        Comment


        • #5
          I don't know either, but the bottom line is that it works, and the 3 lines doesn't, so I'll take that any day, unless someone knows why it's not working in Windows.

          Ben

          Comment


          • #6
            Probably the 3 lines "solution" does not work because it is not portable?
            The executable on Windows is a BAT file and not a shell script.

            /rafa

            Comment


            • #7
              I gather it's a good example of elegance of Linux (3 LOC - everything straight to the point) and bloatness of Windows.
              A simple task requires 'The War and Peace' coding.
              But it's just me. What can I say, I love 'lean and mean' approach.
              Sorry for offtop.

              Comment


              • #8
                I agree. I've always liked Unix better as an "industrial strength" operating system.

                No offense taken.

                Ben

                Comment

                Working...
                X