How do you actually execute the system call. I normally use it as printed
below (on Tomcat 4.0x, Apache 1.3x, Redhat 6/7/8) and it works just fine.
String[] strCommand contains the single elements of the call, so "ls -al"
would be strCommand[0] = "ls", strCommand[1] = "-al", while "ls" obviously
would just be strCommand[0] = "ls". However, what I'm still puzzled about
is, as indicated by another reader, the security problem related to this.
Everyone programming webapps for a server has basically root rights on this
machine, at least with the default settings. Any suggestions how to get
around this or where to start reading?

########
  private static void doSyscommand(String[] strCommand) {
    Process p;
    try {
        p = Runtime.getRuntime().exec(strCommand);
        p.waitFor();
    } catch (IOException e) {
        System.err.println(e.getMessage());
    } catch (InterruptedException e) {
        System.err.println("Interrupted Exception raised: " +
e.getMessage());
    }
  }
########

-----Original Message-----
From: Richard Wong [mailto:[EMAIL PROTECTED]]
Sent: 15 November 2002 05:42 AM
To: [EMAIL PROTECTED]
Subject: RE: System call problem on Tomcat


We are still stuck with the problem.  Can someone kindly help?

-----Original Message-----
From: Richard Wong [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 12, 2002 10:35 PM
To: [EMAIL PROTECTED]
Subject: System call problem on Tomcat


Dear Sir/Madam,

      I have written a servlet that will make a system call using following
statement:
             Runtime.getRuntime().exec("ls");

      The servlet failed (even cause tomcat to shutdown) and the following
error occurs:

StandardServer.await: accept: java.net.SocketException: Interrupted system
call
java.net.SocketException: Interrupted system call
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:463)
        at java.net.ServerSocket.implAccept(ServerSocket.java:238)
        at java.net.ServerSocket.accept(ServerSocket.java:217)
        at
org.apache.catalina.core.StandardServer.await(StandardServer.java:293)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:794)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)

        I have tried several simple Linux commands and I get the same
problem (eg. sleep 1).  Can anyone help?

        The system is running on Redhat 7.2, tomcat 4.0.4 and Java 1.3.1.

Regards,
Richard.


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to