users@glassfish.java.net

Re: Runtime.exec from glassfish as a windows service

From: NBW <emailnbw_at_gmail.com>
Date: Thu, 12 Aug 2010 12:27:05 -0400

Hi Alan,

What exactly do you mean by 'stopped working'? Does your code execution
hang? If so did you take a thread dump? Did it work as a service until you
add -Xrs or is this the first time you ran it as a service? A common trap
when using Runtime.exec etc. is not draining the processes STDERR/STDOUT
streams in separate threads. Failing to do so can result in random
deadlocking during process execution. Here's an example of a way to deal
with that issue [1].

-Noah

[1] - http://vyvaks.wordpress.com/2006/05/27/does-runtimeexec-hangs-in-java/

On Thu, Aug 12, 2010 at 10:57 AM, <glassfish_at_javadesktop.org> wrote:

> Hi,
>
> I have a problem on Glassfish 3.0.1 running on windows server 2008. I'am
> using a servlet to start another process but this has stopped working. I
> recently changed Glassfish to run as a service so that it would not
> terminate if a user logs out. Up until the service change all was working
> fine.
>
> Test code snippet :-
>
> String cmd = "notepad";
> System.out.println(cmd);
> Runtime rt = Runtime.getRuntime();
> Process proc = rt.exec( cmd );
>
> There are no error messages or exceptions in the server log.
> The code still works fine on my development XP machine where Glassfish is
> not a service.
>
> Is Glassfish running as a service the problem?
> How can I resolve this issue?
>
> Thanks in advance
>
> Alan
> [Message sent by forum member 'alan_314']
>
> http://forums.java.net/jive/thread.jspa?messageID=480017
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>