File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes tomcat as service -> cannot start WINWORD.exe Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat as service -> cannot start WINWORD.exe" Watch "tomcat as service -> cannot start WINWORD.exe" New topic
Author

tomcat as service -> cannot start WINWORD.exe

Fusari William
Greenhorn

Joined: Mar 16, 2011
Posts: 3
Hi,
i'm using tomcat 6.0.29 with jdk 1.6.0_21 and i'm in Windows (7 at 64 bit, but i've try in Windows 7 32 bit, Windows Vista, Windows Xp).

I've got a servlet that create file "example.doc".
When it finish i want to start Word and open my document.

I try 3 way:
(FinalFile="example.doc")

1)
where execfile.exe is my application write in C that open calling system function.

2)

3)
where "open_document.bat" call "start C:\MELCOS\run\web\tomcat6029\webapps\MELCOS\fronte_quadro\example.doc"

If i start manually Tomcat, i see in Task Manager process Tomcat started with my administrator user and all of 1-2-3 solutions start WINWORD.exe and Microsoft Word open without problem.
If Tomcat is Windows' service, i see in Task Manager process Tomcat started with SYSTEM user and all of 1-2-3 solutions start WINWORD.exe, but Microsoft Word don't open.

I try to use CGI....web.xml and context.xml were modify without problem:

1) web.xml


2) context.xml


I create folder WEB-INF\cgi and i paste my files here (execfile.exe and open_document.bat).
I call via URL: http://localhost:8082/MELCOS/cgi-bin/execfile.exe or http://localhost:8082/MELCOS/cgi-bin/open_document.bat.

Nothing.....process WINWORD.exe start with SYSTEM user, and interface of Microsoft Word don't appear.

I've try to modify catalina.policy; i add these:



But nothing....same problem...

What i've to do?

Help me please!

Thanks very much and sorry for my bad english.

BeLakor88
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 501
    
    5
Try this:
- Type services.msc from Start menu > Run
- Find the Tomcat6 service in the Services window
- Right click > Properties > LogOn tab > Check "allow service to interact with desktop"

PS: Running something like Word with system account is a bad idea, security wise. If this is a production level solution, you should prefer launching Word with regular account privileges using "runas" command or some such.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16054
    
  21

Karthik Shiraly wrote:

PS: Running something like Word with system account is a bad horrible idea, security wise. If this is a production level solution, you should prefer launching Word with regular account privileges using "runas" command or some such.


Don't forget that some of the most infamous infections of the Internet were done courtesy of security holes in MS Office!


Customer surveys are for companies who didn't pay proper attention to begin with.
Fusari William
Greenhorn

Joined: Mar 16, 2011
Posts: 3
Karthik Shiraly wrote:Try this:
- Type services.msc from Start menu > Run
- Find the Tomcat6 service in the Services window
- Right click > Properties > LogOn tab > Check "allow service to interact with desktop"

PS: Running something like Word with system account is a bad idea, security wise. If this is a production level solution, you should prefer launching Word with regular account privileges using "runas" command or some such.


Nothing with check...i've just try it.
Nothing with runas because all of my account haven't password.

Other ideas?
Fusari William
Greenhorn

Joined: Mar 16, 2011
Posts: 3
I'm try with PsTools (PsExec.exe), but nothing....it start without problem if i call it directy, if i call it in a servlet it start with SYSTEM user and don't run anything.

I've got another idea: i create a demon who start when tomcat service start, listening port 33350 (for example), and when i try to connect to this port from my servlet, it open my document.

It's a good idea?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat as service -> cannot start WINWORD.exe