I too am having the same problem using "Runtime.exec". According
to Jason Hunter's most excellent book I should be able to use
this method, and additionally he provides an example. He points
out that there may be a problem with the Security Manager of the
web server in terms of granting access to execute programs.
In light of fixing this I have gone through all of the settings
in the administration applet and set "Execute programs" to Yes. I
am running JWS 1.1.3 on Solaris, and have granted execute
programs to the following attributes:
In the defaultRealm:
admin
jeeves
In the servlet Mgr Realm:
admin
unsigned
In the UNIX realm:
myUserName
I have added the servlet to the list of servlets, and added the
servlet to the Resources section in Security. Despite doing this
I still appear to not be able to gleen any output from a
runtime.exec call. The access logs provide no additional
information, and do not report any errors. Is there some security
setting somewhere I am missing, or is this a bug?
~David
==========================================
David Valentine
Software Design Engineer, NEC Australia
[EMAIL PROTECTED]
(61) 3 9271 4541
==========================================
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's
> Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf
Of Tim
> Leist
> Sent: Thursday, March 25, 1999 12:08 PM
> To: [EMAIL PROTECTED]
> Subject: Executing system command from a servlet
>
>
> Hi,
> The following code runs fine from a command line
application,
> returning information from the exec() Process. But when the
code is
> executed in a servlet, the servlet seems to hang. The system
> process is
> starts but can't seem to communicate with the servlet. Is
there any
> reason a servlet can't read the input stream from a Process?
> -----<snip>
> //execute the system command.
> try {
> Runtime shell = Runtime.getRuntime();
> Process p = shell.exec( cmd);
> //Get the input stream of the subprocess.
> BufferedReader in = new BufferedReader(new InputStreamReader(
> p.getInputStream()));
> //Get the error stream of the subprocess.
> BufferedReader err = new BufferedReader(new
InputStreamReader(
> p.getErrorStream()));
>
> String line;
> while ( ( line = in.readLine()) != null)
> System.out.println( line);
>
> while ( ( line = err.readLine()) != null)
> System.out.println( line);
> } catch (IOException e)
System.out.println( e.getMessage());}
> ---------<snip>
> Thanks
>
> ______________________________________________________________
> _____________
> 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
>
___________________________________________________________________________
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