honyk wrote:
On 2013-06-26 André Warnier wrote:
honyk wrote:
Dear All,
I have a JSF2.0 app that executes (via ProcessBuilder) an external
script.
This script opens PPTX via PowerPoint ActiveX object, manipulate it
and
save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.
When tomcat 7 is launched using startup.bat (with original settings),
it
works fine.
When tomcat runs as a service, opening the PPTX in the PowerPoint
fails
because of Out Of Memory error regardless Xmx settings
(tomcat7w.exe).
I originally asked PowerPoint forum, but haven't get any explanation
yet:
http://answers.microsoft.com/thread/37cbebf6-4003-4ab0-9295-
92413aaecc2e
But as the entry point is Tomcat and the only difference between
problematic
and non problematic behavior is the 'service' mode, maybe there is
something
related in the tomcat7.exe code base. Just guessing.
Has anybody an idea why both modes behave differently?
Hi.
The problem has nothing to do with Tomcat per se.
It is due to running a Microsoft Office program (or library modules
such as the "Interop"
series) as a sub-process of a Windows Service (and thus in the same
Service context) which
is something that is not in the design of Microsoft Office, not
supported by Microsoft,
and even actively discouraged by Microsoft.
See : http://support.microsoft.com/kb/257757
The problem is basically that a Windows Service does not run in the
same "environment" as
a "user session" environment, and as they say in that article, you will
certainly
experience "unstable behavior and/or deadlock" somewhere, and will get
no help for it.
I read this article but because I do not need intraction and my code doesn't
run simultaneously and tomcat is launched using my credentials - I still
thought it could be possible.
Now realizing that tomcat launched using my credentials do not necesarily
mean that Office use the same...
Personal experience : some things will work with one MS-Office program,
and totally fail
with another; even simple things like opening or saving a file. It may
work with one
file, and fail with another, for no apparent reason.
You get an OOM error in this case, but other cases may be "file not
found" (although it's
there) or whatever other bizarre failures.
Ultimately it is unpredictable, frustrating and time-consuming.
I was an optimist when everything worked in the user mode...
Solutions :
1) instead of MS-Office, use LibreOffice or OpenOffice. Both can run
in "headless" mode,
and provide an API to have them "do things with documents". And both
can open and
manipulate MS-Office documents. Depending on what you do, there may be
some differences
in the results, but it works fine for many things.
Or try one of the other solutions suggested in the above article.
(I have not tried them, I use OpenOffice/LibreOffice).
I'll give it a try. I originaly tested Apache POI, but required
functionality is not implemented yet.
2) do not run Tomcat as a Service. Create a virtual Windows machine,
and run it in a user
console (with startup.bat). You can restrict access to the VM, and
since it is a VM, it
can run unattended, just as a service would.
(I am also using this scheme, when circumstances permit).
But in that case, also pay attention to the licensing considerations at
the end of the
article.
I am quite lost in this ;-) But I'll investigate further.
Thanks a lot for your exhaustive analysis! Finally it looks my way is no way
:-)
No problem. I went myself through the exact same issues as you described, I did believe
that there must be a workaround, tried a number of things with great loss of time, and
finally had to admit that the MS article was right and that there is no good solution with
MS-Office when starting it from a Service.
About the Virtual Machine solution : usually, when you want something to run as a Service,
it is because it has to run in the background, without a user being logged-in, because of
security e.g. Also because otherwise, when the logged-in user logs off, any program that
he's running get killed.
With Virtual Machines (VM in short), you can create a Windows machine that has no real
physical console, runs all the time, and where a user session can stay logged-in all the
time. So in that kind of machine, it is not usually a problem if a user is logged-in and
remains logged-in, with a console window open, and Tomcat running in it.
And in that console window, your Tomcat could be running via startup.bat, and execute your
MS-Office commands without problems, as it is not a Service.
With respect to licensing, as long as that machine runs a licensed version of MS-Office,
and all your Tomcat client workstations themselves are allowed to use MS-Office, you
shoukd be in the clear.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org