You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Teran <da...@cluster9.com> on 2005/10/20 19:01:00 UTC

Windows, Runtime.exec() problems

Hi,

i am trying to call a native application from a servlet application  
(specifically an webservice based on axis 1.3) with the following code:

         Process p = Runtime.getRuntime().exec(args);
         StreamReader isr = new StreamReader(p.getInputStream()); //  
just uses separate thread to read from the process
         StreamReader esr = new StreamReader(p.getErrorStream()); //  
just uses separate thread to read from the process
         try {
             p.waitFor();
         } catch (InterruptedException e) {}
         Result r = new Result(isr.getResult(), esr.getResult());

the problem is that the application which is called with the exec  
command, a realbasic app which uses OLE to print out documents with  
PowerPoint does not work if this code is called inside the tomcat  
JVM. If i copy paste the code to a simple class, compile the class  
and use the same arguments for the exec, everything works fine.

I am quite new to windows, just have a lot of UNIX experience and i  
am lost here.

regards, David


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Windows, Runtime.exec() problems [solved]

Posted by "Christoph P. Kukulies" <ku...@kukulies.org>.
On Fri, Oct 21, 2005 at 08:39:16AM +0200, David Teran wrote:
> Well, it was not tomcat, the problem was starting tomcat as windows  
> service, then the process invoked by exec cannot use OLE Automation.

This reminds me of the situation when I wrote a service that
was supposed to interact with the desktop (which is not normally the
case with many services). The service then cannot spawn
subprocesses of a certain kind unless it is created with the
flag SERVICE_INTERACTIVE_PROCESS.

schService = CreateService(
        schSCManager,               // SCManager database
        TEXT(SZSERVICENAME),        // name of service
        TEXT(SZSERVICEDISPLAYNAME), // name to display
        SERVICE_ALL_ACCESS,         // desired access
        SERVICE_INTERACTIVE_PROCESS|SERVICE_WIN32_OWN_PROCESS,  // service type
        SERVICE_DEMAND_START,       // start type
        SERVICE_ERROR_NORMAL,       // error control type
        szPath,			// service's binary
        NULL,			// no load ordering group
        NULL,			// no tag identifier
        TEXT(SZDEPENDENCIES),       // dependencies
        NULL,                       // LocalSystem account
        NULL);                      // no password


I could not find the location where Tomcat installs itself as a service.
It must be somewhere deep down in 
apache-tomcat-5.5.12-src\jakarta-tomcat-catalina\catalina\src\share\org\apache\
catalina\

and it probably uses some java class of the apache OS interface (Win32
in that case) which in turn is burried in the apache dource tree. 


> 
> regards, David
> 
> Am 20.10.2005 um 19:15 schrieb David Teran:
> 
> >Hi,
> >
> >thanks for the quick response, no, the firewall is already  
> >deactivated.
> >
> >regards, David
> >
--
Chris Christoph P. U. Kukulies kuku_at_kukulies.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Windows, Runtime.exec() problems [solved]

Posted by David Teran <da...@cluster9.com>.
Well, it was not tomcat, the problem was starting tomcat as windows  
service, then the process invoked by exec cannot use OLE Automation.

regards, David

Am 20.10.2005 um 19:15 schrieb David Teran:

> Hi,
>
> thanks for the quick response, no, the firewall is already  
> deactivated.
>
> regards, David
>
> Am 20.10.2005 um 19:06 schrieb jacob hookom:
>
>
>> You might be experiencing the same issues I just had
>> with FTP sockets-- make sure your windows firewall is
>> disabled.
>>
>> --- David Teran <da...@cluster9.com> wrote:
>>
>>
>>
>>> Hi,
>>>
>>> i am trying to call a native application from a
>>> servlet application
>>> (specifically an webservice based on axis 1.3) with
>>> the following code:
>>>
>>>          Process p =
>>> Runtime.getRuntime().exec(args);
>>>          StreamReader isr = new
>>> StreamReader(p.getInputStream()); //
>>> just uses separate thread to read from the process
>>>          StreamReader esr = new
>>> StreamReader(p.getErrorStream()); //
>>> just uses separate thread to read from the process
>>>          try {
>>>              p.waitFor();
>>>          } catch (InterruptedException e) {}
>>>          Result r = new Result(isr.getResult(),
>>> esr.getResult());
>>>
>>> the problem is that the application which is called
>>> with the exec
>>> command, a realbasic app which uses OLE to print out
>>> documents with
>>> PowerPoint does not work if this code is called
>>> inside the tomcat
>>> JVM. If i copy paste the code to a simple class,
>>> compile the class
>>> and use the same arguments for the exec, everything
>>> works fine.
>>>
>>> I am quite new to windows, just have a lot of UNIX
>>> experience and i
>>> am lost here.
>>>
>>> regards, David
>>>
>>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>
>>
>>> To unsubscribe, e-mail:
>>> users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail:
>>> users-help@tomcat.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>> __________________________________
>> Yahoo! Music Unlimited
>> Access over 1 million songs. Try it free.
>> http://music.yahoo.com/unlimited/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Windows, Runtime.exec() problems

Posted by David Teran <da...@cluster9.com>.
Hi,

thanks for the quick response, no, the firewall is already deactivated.

regards, David

Am 20.10.2005 um 19:06 schrieb jacob hookom:

> You might be experiencing the same issues I just had
> with FTP sockets-- make sure your windows firewall is
> disabled.
>
> --- David Teran <da...@cluster9.com> wrote:
>
>
>> Hi,
>>
>> i am trying to call a native application from a
>> servlet application
>> (specifically an webservice based on axis 1.3) with
>> the following code:
>>
>>          Process p =
>> Runtime.getRuntime().exec(args);
>>          StreamReader isr = new
>> StreamReader(p.getInputStream()); //
>> just uses separate thread to read from the process
>>          StreamReader esr = new
>> StreamReader(p.getErrorStream()); //
>> just uses separate thread to read from the process
>>          try {
>>              p.waitFor();
>>          } catch (InterruptedException e) {}
>>          Result r = new Result(isr.getResult(),
>> esr.getResult());
>>
>> the problem is that the application which is called
>> with the exec
>> command, a realbasic app which uses OLE to print out
>> documents with
>> PowerPoint does not work if this code is called
>> inside the tomcat
>> JVM. If i copy paste the code to a simple class,
>> compile the class
>> and use the same arguments for the exec, everything
>> works fine.
>>
>> I am quite new to windows, just have a lot of UNIX
>> experience and i
>> am lost here.
>>
>> regards, David
>>
>>
>>
>>
> ---------------------------------------------------------------------
>
>> To unsubscribe, e-mail:
>> users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail:
>> users-help@tomcat.apache.org
>>
>>
>>
>
>
>
>
> __________________________________
> Yahoo! Music Unlimited
> Access over 1 million songs. Try it free.
> http://music.yahoo.com/unlimited/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Windows, Runtime.exec() problems

Posted by jacob hookom <ho...@yahoo.com>.
You might be experiencing the same issues I just had
with FTP sockets-- make sure your windows firewall is
disabled.

--- David Teran <da...@cluster9.com> wrote:

> Hi,
> 
> i am trying to call a native application from a
> servlet application  
> (specifically an webservice based on axis 1.3) with
> the following code:
> 
>          Process p =
> Runtime.getRuntime().exec(args);
>          StreamReader isr = new
> StreamReader(p.getInputStream()); //  
> just uses separate thread to read from the process
>          StreamReader esr = new
> StreamReader(p.getErrorStream()); //  
> just uses separate thread to read from the process
>          try {
>              p.waitFor();
>          } catch (InterruptedException e) {}
>          Result r = new Result(isr.getResult(),
> esr.getResult());
> 
> the problem is that the application which is called
> with the exec  
> command, a realbasic app which uses OLE to print out
> documents with  
> PowerPoint does not work if this code is called
> inside the tomcat  
> JVM. If i copy paste the code to a simple class,
> compile the class  
> and use the same arguments for the exec, everything
> works fine.
> 
> I am quite new to windows, just have a lot of UNIX
> experience and i  
> am lost here.
> 
> regards, David
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail:
> users-help@tomcat.apache.org
> 
> 



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org