Re: Java programm to Shutdwon the tomcat server

2010-03-02 Thread Pid

On 01/03/2010 14:26, dBenjamin wrote:


I using customize icon to launch my application before starting the tomcat my
java program will check and then it will allow to start the tomcat otherwise
it will change the port and server will get start.


How are you changing the port?  Are you somehow editing the XML file and 
then restarting the server?




I am validating shutdown port using
Socket socket = new Socket(127.0.0.1,JVMPort);


is JVMPort the value for the Tomcat shutdown port?


if (socket.isConnected()) {
port =true;
  socket.close();

}
If I check the port it will through the exception:
Mar 1, 2010 9:22:58 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received


You are, perhaps inadvertently, causing an empty command to be sent to 
the shutdown port.  The log message below is the expected response if 
you do so.


If you need to start Tomcat programmatically, I strongly recommend that 
you look at the Embedded documentation I sent earlier.



p


Mar 1, 2010 9:22:58 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
After that it was not receiving shutdown request






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-03-01 Thread Pid

On 01/03/2010 04:23, dBenjamin wrote:


Thanks for helping...
Can you please find my scenario?
1.  I am using windows Environment.
2.  I am using tomcat 6 binary distribution versions here we cannot get pid
from the windows.
3.  For my requirement before starting the tomcat server I need to verify 
the
port availability if any other application using then I have change both
shutdown port and http port.


OK...


I facing problem to change the port address, I
am validating shutdown port using socket and http port using java.net
package.


How are you doing this, inside a Tomcat application, or outside of it - 
if so please explain more.



When I change the port I am getting invalid request received error
WARNING: StandardServer.await: Invalid command '' received.  Because of this
error I am not able to shutdown the server. So I would like to shutdown the
server using java program.


How are you changing the port, in what bit of code?
It sounds like you're doing something wrong here.


command prompt when we type CTRL –C server getting shutdown I would like to
know can we possible to send CTRL-C through java program.
Runtime.getRuntime().exec(command to shut down tomcat); here we can call
shutdown bat file to stop the server but let me know if any other way I can
stop instead calling bat file through Runtime.getRuntime().exe(“”);
Please help me to shutdown the server through java program? If possible let
me know the procedure?


Forget this for now, until we establish the above.


p



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Java programm to Shutdwon the tomcat server

2010-03-01 Thread Joseph Morgan
True...we still don't have a clue what the OP's really trying to do... 

-Original Message-
From: Pid [mailto:p...@pidster.com] 
Sent: Friday, February 26, 2010 5:44 PM
To: Tomcat Users List
Subject: Re: Java programm to Shutdwon the tomcat server

On 26/02/2010 18:40, Joseph Morgan wrote:
 And... if you are writing a java program do to this for you, such as a UI, 
 then you'll need to essentially reverse this to start it.  PID's idea to 
 connect to the port to send the shutdown command will work for shutting it 
 down, but to start it back up... you'll still need to do 
 Runtime.getRuntime().exec(...) to get it going again from within the Java UI.

At the risk of veering off-topic: if the OP wishes to start and stop 
Tomcat programmatically then they may consider the 'embedded' Tomcat method.

 
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/startup/Embedded.html


p

 -Original Message-
 From: André Warnier [mailto:a...@ice-sa.com]
 Sent: Friday, February 26, 2010 12:10 PM
 To: Tomcat Users List
 Subject: Re: Java programm to Shutdwon the tomcat server


 I suggest the following :

 I) If tomcat is running as a Windows service, then you should shut it
 down by stopping the Windows Service (and not by stopping down Tomcat
 directly).

 To stop the Tomcat-related Windows Service, there are two methods :

 a) use the Services applet of Windows
 (e.g. My Computer --  Manage --  Services and Applications --
 Services --  Apache Tomcat 6), right-click and choose Stop service

 b) in a command window, use the command
 net stop Apache Tomcat 6

 II) If Tomcat is not running as a Windows Service, but in a command
 window, then :

 a) if you have started Tomcat with the command startup.bat, then a
 separate command window was opened to run Tomcat.
 In that case, you have 2 choices to stop Tomcat :

 a-1) in the same window where you started Tomcat with the command
 startup.bat, enter the command shutdown.bat.

 a-2) in the command window where Tomcat is running, enter CTRL-C

 b) if you have started Tomcat with the command catalina.bat run, then
 Tomcat runs directly in the Window where you entered this command.
 To stop it, type CTRL-C.

 c) in any of the cases (a) or (b) above, the other methods indicated in
 the previous messages will work also.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Java programm to Shutdwon the tomcat server

2010-03-01 Thread Joseph Morgan
Oops.. should have read the thread... I spoke too soon

-Original Message-
From: Joseph Morgan [mailto:joseph.mor...@ignitesales.com] 
Sent: Monday, March 01, 2010 7:06 AM
To: Tomcat Users List; p...@pidster.com
Subject: RE: Java programm to Shutdwon the tomcat server

True...we still don't have a clue what the OP's really trying to do... 

-Original Message-
From: Pid [mailto:p...@pidster.com] 
Sent: Friday, February 26, 2010 5:44 PM
To: Tomcat Users List
Subject: Re: Java programm to Shutdwon the tomcat server

On 26/02/2010 18:40, Joseph Morgan wrote:
 And... if you are writing a java program do to this for you, such as a UI, 
 then you'll need to essentially reverse this to start it.  PID's idea to 
 connect to the port to send the shutdown command will work for shutting it 
 down, but to start it back up... you'll still need to do 
 Runtime.getRuntime().exec(...) to get it going again from within the Java UI.

At the risk of veering off-topic: if the OP wishes to start and stop 
Tomcat programmatically then they may consider the 'embedded' Tomcat method.

 
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/startup/Embedded.html


p

 -Original Message-
 From: André Warnier [mailto:a...@ice-sa.com]
 Sent: Friday, February 26, 2010 12:10 PM
 To: Tomcat Users List
 Subject: Re: Java programm to Shutdwon the tomcat server


 I suggest the following :

 I) If tomcat is running as a Windows service, then you should shut it
 down by stopping the Windows Service (and not by stopping down Tomcat
 directly).

 To stop the Tomcat-related Windows Service, there are two methods :

 a) use the Services applet of Windows
 (e.g. My Computer --  Manage --  Services and Applications --
 Services --  Apache Tomcat 6), right-click and choose Stop service

 b) in a command window, use the command
 net stop Apache Tomcat 6

 II) If Tomcat is not running as a Windows Service, but in a command
 window, then :

 a) if you have started Tomcat with the command startup.bat, then a
 separate command window was opened to run Tomcat.
 In that case, you have 2 choices to stop Tomcat :

 a-1) in the same window where you started Tomcat with the command
 startup.bat, enter the command shutdown.bat.

 a-2) in the command window where Tomcat is running, enter CTRL-C

 b) if you have started Tomcat with the command catalina.bat run, then
 Tomcat runs directly in the Window where you entered this command.
 To stop it, type CTRL-C.

 c) in any of the cases (a) or (b) above, the other methods indicated in
 the previous messages will work also.


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-03-01 Thread Pid

On 01/03/2010 13:09, Joseph Morgan wrote:

Oops.. should have read the thread... I spoke too soon


We know what they're trying to do but not how they're doing it, though I 
suspect I have an idea and it's not pretty.



p


-Original Message-
From: Joseph Morgan [mailto:joseph.mor...@ignitesales.com]
Sent: Monday, March 01, 2010 7:06 AM
To: Tomcat Users List; p...@pidster.com
Subject: RE: Java programm to Shutdwon the tomcat server

True...we still don't have a clue what the OP's really trying to do...

-Original Message-
From: Pid [mailto:p...@pidster.com]
Sent: Friday, February 26, 2010 5:44 PM
To: Tomcat Users List
Subject: Re: Java programm to Shutdwon the tomcat server

On 26/02/2010 18:40, Joseph Morgan wrote:

And... if you are writing a java program do to this for you, such as a UI, then 
you'll need to essentially reverse this to start it.  PID's idea to connect to 
the port to send the shutdown command will work for shutting it down, but to 
start it back up... you'll still need to do Runtime.getRuntime().exec(...) to 
get it going again from within the Java UI.


At the risk of veering off-topic: if the OP wishes to start and stop
Tomcat programmatically then they may consider the 'embedded' Tomcat method.


http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/startup/Embedded.html


p


-Original Message-
From: André Warnier [mailto:a...@ice-sa.com]
Sent: Friday, February 26, 2010 12:10 PM
To: Tomcat Users List
Subject: Re: Java programm to Shutdwon the tomcat server


I suggest the following :

I) If tomcat is running as a Windows service, then you should shut it
down by stopping the Windows Service (and not by stopping down Tomcat
directly).

To stop the Tomcat-related Windows Service, there are two methods :

a) use the Services applet of Windows
(e.g. My Computer --   Manage --   Services and Applications --
Services --   Apache Tomcat 6), right-click and choose Stop service

b) in a command window, use the command
net stop Apache Tomcat 6

II) If Tomcat is not running as a Windows Service, but in a command
window, then :

a) if you have started Tomcat with the command startup.bat, then a
separate command window was opened to run Tomcat.
In that case, you have 2 choices to stop Tomcat :

a-1) in the same window where you started Tomcat with the command
startup.bat, enter the command shutdown.bat.

a-2) in the command window where Tomcat is running, enter CTRL-C

b) if you have started Tomcat with the command catalina.bat run, then
Tomcat runs directly in the Window where you entered this command.
To stop it, type CTRL-C.

c) in any of the cases (a) or (b) above, the other methods indicated in
the previous messages will work also.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-03-01 Thread dBenjamin

I using customize icon to launch my application before starting the tomcat my
java program will check and then it will allow to start the tomcat otherwise
it will change the port and server will get start.

I am validating shutdown port using 
Socket socket = new Socket(127.0.0.1,JVMPort); 
if (socket.isConnected()) { 
port =true;
  socket.close(); 

}
If I check the port it will through the exception:
Mar 1, 2010 9:22:58 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
Mar 1, 2010 9:22:58 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
After that it was not receiving shutdown request 

-- 
View this message in context: 
http://old.nabble.com/Java-programm-to-Shutdwon-the-tomcat-server-tp27714568p27744212.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-03-01 Thread André Warnier

dBenjamin wrote:

Thanks for helping...
Can you please find my scenario?


We could probably help better if we understood exactly what you are
trying to achieve (and why), which is not very clear at the moment.


1.  I am using windows Environment.


Ok, but are you running Tomcat as a Windows Service, or as an
application in a command window ?

If you are running Tomcat as an application in a command window, then
when the user who started Tomcat logs off, Tomcat will stop.



2.  I am using tomcat 6 binary distribution versions here we cannot get pid
from the windows.


I do not understand why not.
Try the command netstat -b and look at the last column. It shows the 
pid of the process using each port.

Look at the help for the netstat command for more options.


3.  For my requirement before starting the tomcat server I need to verify 
the
port availability if any other application using then I have change both
shutdown port and http port. 


One way to do this (maybe the only way) is to change the
(tomcat_dir)/conf/server.xml file, *before* starting Tomcat.
You cannot start Tomcat and change these ports afterward.
It is too late then, because Tomcat will already have tried to open
these ports, and fail to start if they are already in use.

 I facing problem to change the port address, I

am validating shutdown port using socket


what do you mean ?

 and http port using java.net
package. 


what do you mean ?


All you need to know, before starting Tomcat, is if these ports are 
already in use. You can do that with the same method for both ports. 
There is no reason to use a different mechanism for each port.



Maybe have a look at this :

1)
*Before* you start Tomcat, open a Windows command window.
Let's call this window A.
In window A, run the command

netstat -abn -p TCP

and read the lines that are output by that command.
The lines which have LISTEN in it are the interesting ones. They show 
what listening ports are already used, and by which process.


2) Now open another command window B, and go to the top directory where 
you installed Tomcat (for example, c:\apache-tomcat-6.0.24).

Then start Tomcat, using the command :
bin\startup.bat
Tomcat should start, in a 3rd command window C.

3) Now, in the command window A, enter the same command again :
netstat -abn -p TCP
Now you should see 2 additional LISTEN ports, and you should see that 
they are used by the process which runs Tomcat. You should see 2 lines 
like this :

TCP0.0.0.0:8080  0.0.0.0:0   ABHÖREN1164 [java.exe]
TCP127.0.0.1:8005  0.0.0.0:0 ABHÖREN1164 [java.exe]

(instead of ABHÖREN, you will see LISTEN, if your Windows speaks English)
In my case, the shutdown port of Tomcat is 8005, and the HTTP port is 
8080. That is why I get the 2 lines above.


4) By default, the Tomcat shutdown port is 8005, and the shutdown string 
is SHUTDOWN.

So now, in the same window A, enter this command :
telnet localhost 8005

and you should get a new line. On this new line, type
SHUTDOWN
(in capitals, and you will not see it on the screen, because Tomcat does 
not echo this)
If you finish this line by the CR key, you will see the Tomcat running 
in Windows C shutting down (and window C will close).


---

It would be better if you tried to explain what you want to do and why 
you want to do that.  Do not explain how you want to do it, let us 
suggest a way.


But now I will try to guess what you want to do, and trying to recommend 
a way of doing it.


- you want to start Tomcat, and you want to make sure that it starts.
For that, you need to be sure that the ports which Tomcat needs to open, 
are not already used by something else.
- and after Tomcat is started, you want to be able to shut it down 
programmatically.


So, do as follows :
- create a standard server.xml file for Tomcat, which uses port 8005 for 
the shutdown, and 80 for the HTTP port

- use the command
netstat -abn -p TCP
to find out if the ports 8005 and 80 are free.
If yes, you can start Tomcat as is.
- if not, you have to modify the server.xml file to use 2 ports that are 
free, and *then* start Tomcat.

- when Tomcat is started, note the port finally chosen for the shutdown port
- then do whatever you want to do with Tomcat
- to stop Tomcat, open a TCP socket connection to localhost: (where 
 is that shutdown port), send the string SHUTDOWN on that 
connection, followed by a CR/LF port. Then close this socket.

This should be enough to shut down Tomcat.

It will be different if Tomcat is running as a Windows Service.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-02-28 Thread dBenjamin

Thanks for helping...
Can you please find my scenario?
1.  I am using windows Environment.
2.  I am using tomcat 6 binary distribution versions here we cannot get pid
from the windows.
3.  For my requirement before starting the tomcat server I need to verify 
the
port availability if any other application using then I have change both
shutdown port and http port.  I facing problem to change the port address, I
am validating shutdown port using socket and http port using java.net
package. When I change the port I am getting invalid request received error
WARNING: StandardServer.await: Invalid command '' received.  Because of this
error I am not able to shutdown the server. So I would like to shutdown the
server using java program. 

command prompt when we type CTRL –C server getting shutdown I would like to
know can we possible to send CTRL-C through java program. 
Runtime.getRuntime().exec(command to shut down tomcat); here we can call
shutdown bat file to stop the server but let me know if any other way I can
stop instead calling bat file through Runtime.getRuntime().exe(“”);
Please help me to shutdown the server through java program? If possible let
me know the procedure?

-- 
View this message in context: 
http://old.nabble.com/Java-programm-to-Shutdwon-the-tomcat-server-tp27714568p27740049.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-02-26 Thread Pid

On 26/02/2010 04:29, dBenjamin wrote:


Thanks for helping developers…
Can you please help me I am facing problem to shutdown the tomcat server in
windows platform (xp, vista, windows7).
if you click CTRL+ C in the tomcat console window, server getting shutdown.
Like that is any specific command to send through java program to shutdown
the tomcat server.



I'm not sure I completely understand what you're asking.

Are you asking how to shutdown the server?


p

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Java programm to Shutdwon the tomcat server

2010-02-26 Thread Joseph Morgan
You can send any system command through a Java program.  Are you developing or 
working with some kind of management tool and you want to know how to program 
it to stop Tomcat???

It depends on if you are running tomcat as a service or not, but either way, 
you're going send your commands from java through code looking something like 
this:

Runtime.getRuntime().exec(command to shut down tomcat);

Or one of the exec variants, depending on what you need to do.


-Original Message-
From: dBenjamin [mailto:d...@mail.com] 
Sent: Thursday, February 25, 2010 10:30 PM
To: users@tomcat.apache.org
Subject: Java programm to Shutdwon the tomcat server


Thanks for helping developers…
Can you please help me I am facing problem to shutdown the tomcat server in
windows platform (xp, vista, windows7). 
if you click CTRL+ C in the tomcat console window, server getting shutdown.
Like that is any specific command to send through java program to shutdown
the tomcat server. 

-- 
View this message in context: 
http://old.nabble.com/Java-programm-to-Shutdwon-the-tomcat-server-tp27714568p27714568.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-02-26 Thread Pid

On 26/02/2010 12:59, Joseph Morgan wrote:

You can send any system command through a Java program.  Are you developing or 
working with some kind of management tool and you want to know how to program 
it to stop Tomcat???

It depends on if you are running tomcat as a service or not, but either way, 
you're going send your commands from java through code looking something like 
this:

Runtime.getRuntime().exec(command to shut down tomcat);

Or one of the exec variants, depending on what you need to do.


Or just connect to the appropriate port, and send the shutdown command.


p


-Original Message-
From: dBenjamin [mailto:d...@mail.com]
Sent: Thursday, February 25, 2010 10:30 PM
To: users@tomcat.apache.org
Subject: Java programm to Shutdwon the tomcat server


Thanks for helping developers…
Can you please help me I am facing problem to shutdown the tomcat server in
windows platform (xp, vista, windows7).
if you click CTRL+ C in the tomcat console window, server getting shutdown.
Like that is any specific command to send through java program to shutdown
the tomcat server.




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Java programm to Shutdwon the tomcat server

2010-02-26 Thread Joseph Morgan
Even better!

-Original Message-
From: Pid [mailto:p...@pidster.com] 
Sent: Friday, February 26, 2010 8:00 AM
To: users@tomcat.apache.org
Subject: Re: Java programm to Shutdwon the tomcat server

On 26/02/2010 12:59, Joseph Morgan wrote:
 You can send any system command through a Java program.  Are you developing 
 or working with some kind of management tool and you want to know how to 
 program it to stop Tomcat???

 It depends on if you are running tomcat as a service or not, but either way, 
 you're going send your commands from java through code looking something like 
 this:

 Runtime.getRuntime().exec(command to shut down tomcat);

 Or one of the exec variants, depending on what you need to do.

Or just connect to the appropriate port, and send the shutdown command.


p

 -Original Message-
 From: dBenjamin [mailto:d...@mail.com]
 Sent: Thursday, February 25, 2010 10:30 PM
 To: users@tomcat.apache.org
 Subject: Java programm to Shutdwon the tomcat server


 Thanks for helping developers…
 Can you please help me I am facing problem to shutdown the tomcat server in
 windows platform (xp, vista, windows7).
 if you click CTRL+ C in the tomcat console window, server getting shutdown.
 Like that is any specific command to send through java program to shutdown
 the tomcat server.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-02-26 Thread André Warnier


I suggest the following :

I) If tomcat is running as a Windows service, then you should shut it 
down by stopping the Windows Service (and not by stopping down Tomcat 
directly).


To stop the Tomcat-related Windows Service, there are two methods :

a) use the Services applet of Windows
(e.g. My Computer -- Manage -- Services and Applications -- 
Services -- Apache Tomcat 6), right-click and choose Stop service


b) in a command window, use the command
net stop Apache Tomcat 6

II) If Tomcat is not running as a Windows Service, but in a command 
window, then :


a) if you have started Tomcat with the command startup.bat, then a 
separate command window was opened to run Tomcat.

In that case, you have 2 choices to stop Tomcat :

a-1) in the same window where you started Tomcat with the command 
startup.bat, enter the command shutdown.bat.


a-2) in the command window where Tomcat is running, enter CTRL-C

b) if you have started Tomcat with the command catalina.bat run, then 
Tomcat runs directly in the Window where you entered this command.

To stop it, type CTRL-C.

c) in any of the cases (a) or (b) above, the other methods indicated in 
the previous messages will work also.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Java programm to Shutdwon the tomcat server

2010-02-26 Thread Joseph Morgan
And... if you are writing a java program do to this for you, such as a UI, then 
you'll need to essentially reverse this to start it.  PID's idea to connect to 
the port to send the shutdown command will work for shutting it down, but to 
start it back up... you'll still need to do Runtime.getRuntime().exec(...) to 
get it going again from within the Java UI.



-Original Message-
From: André Warnier [mailto:a...@ice-sa.com] 
Sent: Friday, February 26, 2010 12:10 PM
To: Tomcat Users List
Subject: Re: Java programm to Shutdwon the tomcat server


I suggest the following :

I) If tomcat is running as a Windows service, then you should shut it 
down by stopping the Windows Service (and not by stopping down Tomcat 
directly).

To stop the Tomcat-related Windows Service, there are two methods :

a) use the Services applet of Windows
(e.g. My Computer -- Manage -- Services and Applications -- 
Services -- Apache Tomcat 6), right-click and choose Stop service

b) in a command window, use the command
net stop Apache Tomcat 6

II) If Tomcat is not running as a Windows Service, but in a command 
window, then :

a) if you have started Tomcat with the command startup.bat, then a 
separate command window was opened to run Tomcat.
In that case, you have 2 choices to stop Tomcat :

a-1) in the same window where you started Tomcat with the command 
startup.bat, enter the command shutdown.bat.

a-2) in the command window where Tomcat is running, enter CTRL-C

b) if you have started Tomcat with the command catalina.bat run, then 
Tomcat runs directly in the Window where you entered this command.
To stop it, type CTRL-C.

c) in any of the cases (a) or (b) above, the other methods indicated in 
the previous messages will work also.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Java programm to Shutdwon the tomcat server

2010-02-26 Thread Pid

On 26/02/2010 18:40, Joseph Morgan wrote:

And... if you are writing a java program do to this for you, such as a UI, then 
you'll need to essentially reverse this to start it.  PID's idea to connect to 
the port to send the shutdown command will work for shutting it down, but to 
start it back up... you'll still need to do Runtime.getRuntime().exec(...) to 
get it going again from within the Java UI.


At the risk of veering off-topic: if the OP wishes to start and stop 
Tomcat programmatically then they may consider the 'embedded' Tomcat method.



http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/startup/Embedded.html


p


-Original Message-
From: André Warnier [mailto:a...@ice-sa.com]
Sent: Friday, February 26, 2010 12:10 PM
To: Tomcat Users List
Subject: Re: Java programm to Shutdwon the tomcat server


I suggest the following :

I) If tomcat is running as a Windows service, then you should shut it
down by stopping the Windows Service (and not by stopping down Tomcat
directly).

To stop the Tomcat-related Windows Service, there are two methods :

a) use the Services applet of Windows
(e.g. My Computer --  Manage --  Services and Applications --
Services --  Apache Tomcat 6), right-click and choose Stop service

b) in a command window, use the command
net stop Apache Tomcat 6

II) If Tomcat is not running as a Windows Service, but in a command
window, then :

a) if you have started Tomcat with the command startup.bat, then a
separate command window was opened to run Tomcat.
In that case, you have 2 choices to stop Tomcat :

a-1) in the same window where you started Tomcat with the command
startup.bat, enter the command shutdown.bat.

a-2) in the command window where Tomcat is running, enter CTRL-C

b) if you have started Tomcat with the command catalina.bat run, then
Tomcat runs directly in the Window where you entered this command.
To stop it, type CTRL-C.

c) in any of the cases (a) or (b) above, the other methods indicated in
the previous messages will work also.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Java programm to Shutdwon the tomcat server

2010-02-25 Thread dBenjamin

Thanks for helping developers…
Can you please help me I am facing problem to shutdown the tomcat server in
windows platform (xp, vista, windows7). 
if you click CTRL+ C in the tomcat console window, server getting shutdown.
Like that is any specific command to send through java program to shutdown
the tomcat server. 

-- 
View this message in context: 
http://old.nabble.com/Java-programm-to-Shutdwon-the-tomcat-server-tp27714568p27714568.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org