All,
I have got a simpe servlet whose code is enlosed.
It runs ok in servletrunner on a Solaris box.
When you run it with NES 4.0 as the Web Server, then there are two
independent problems with it.
1-
The line
Process p = Runtime.getRunTime().exec("ls");
sends the machine CPU to near 100%. The only soultion is the brig the Web
Server down!!
2-
The servlet hangs at the line
int e = p.waitFor();
which is currently commented out.
Any help will be appreciated.
Regards,
Mo.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ServletExec extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();
Process p = Runtime.getRuntime().exec("ls");
BufferedReader in = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String s = null;
while ((s = in.readLine()) != null)
{
out.println(s);
}
boolean finished = false;
// try
// {
while (! finished)
{
// System.out.println("waiting");
// int e = p.waitFor();
// System.out.println("done");
int e = 20;
out.println("Process Returned: " + e);
finished = true;
}
// }
// catch (InterruptedException e)
// {
// }
}
}
Mohammad Sahirad
Merrill Lynch Swaps Technology
RMP-06-05
6A Ropemaker
25 Ropemaker Street
London EC2Y 9LY
+44 (0)171 867 4925
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html