views:

3027

answers:

4

What is the experience of working with OpenOffice in server mode? I know OpenOffice is not multithreaded and now I need to use its services in our server.
What can I do to overcome this problem?

I'm using Java.

+2  A: 

Yes, I am using OpenOffice as a document conversion server.

Unfortunately, the solution to your problem is to spawn a pool of OpenOffice processes.

The commons-pool branch of JODConverter (before it moved to code.google.com) implemented this out-of-the-box for you.

vladr
A: 

Vlad is correct about having to run multiple instances of OpenOffice on different ports.

I'd just like to add that OpenOffice doesn't seem to be stable. We run 10 instances of it in a production environment and set the code up to re-try with another instance if the first attempt fails. This way when one of the OpenOffice servers crashes (or doesn't crash but doesn't respond either) production is not affected. Since it's a pain to keep restarting the servers on a daily basis, we're slowly converting all our documents to JasperReports (see iReport for details). I'm not sure how you're using the OpenOffice server; we use it for mail merging (filling out forms for customers). If you need to convert things to PDF, I'd recommend iText.

A: 

OpenOffice can be used in headless mode, but it has not been built to handle a lot of requests in a stressfull production environment.

Using OpenOffice in headless mode has several issues:

  • The process might die/become unavailable.
  • There are several memory leaks issues.
  • Opening several OpenOffice "workers" does not scale as expected, and needs some tweaking to really have different open proccesses (having several OpenOffice copies, several services, running under different users.)

As suggested, jodconverter can be used to access the OpenOffice process.

http://code.google.com/p/jodconverter/wiki/GettingStarted

Mercer Traieste
A: 

you can try this:

http://www.jopendocument.org/

its an opensource java based library that allows you to work with open office documents without open office, thus removing the need for the OOserver.

James Lee