tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maven apache <>
Subject tomcat shut down normally
Date Mon, 06 Jul 2009 02:46:57 GMT
Hi all:I am working with a web service using the tomcat,however I met some
problems recently. The tomcat shut down when my application work wrongly.
I intend to call some command in my web application by the Runtime class,and
I create a new class which extends the Thread to get the Error stream,if the
error is not null so there must be something wrong when call the command
,then I want to throw a exception which I have defined,but this is not
impossible ,since in the run method one can not tho throw his own exception.
So I can just throw the RuntimeException.
In my thought,when I throw the RuntimeException ,my application can be
down,but the tomcat should not shut down! The fact is that once error
occurs(for example ,the command is wrong),the tomcat is shut down itself.
I wonder someone can give a advise.
The following is my thread class to get the error stream:
final class ThreadError extends Thread {
private static Logger LOGGER = Logger.getLogger(ThreadError.class);
private Process ps;
private String cid;
public ThreadError(Process ps, String cid) { = ps;
this.cid = cid;
 * Run the command.
public void run() {
try { reader = new
String line = "";
try {
while ((line = reader.readLine()) != null) {
System.err.println(this.cid + "|ERROR|" + line);
LOGGER.warn(this.cid + "|ERROR|" + line);
} finally {
if ( != 0) {
throw new RuntimeException(
this.cid+ "|ERROR|Execution failure, there might be an error in your
command. [exit code="
+ + "]");
///////////////////////////////// in fact in the above line If I did not
throw the RuntimeException ,the tomcat also shutdown.
} catch ( ioe) {

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message