Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Saturday, March 12, 2011

OpenOffice in server mode

OpenOffice in server mode as a multithreaded service
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.
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.
To start openoffice3 in server mode, use this
soffice -headless accept="socket,host=localhost,port=8100;urp" &
Nuxeo is an Open Source Platform for Enterprise Content Management enabling architects and developers to build, deploy and run the best content-driven applications in an easy way.
Nuxeo applications can be configured with no programming experience, and extended using standardJava EE technologies.
See for installation procedure if not provided by your OS.

46.1.1. Start server

Since version 2.3, OpenOffice can be started in headless mode. This means that under linux, you non longer need to run a Xvfb.
Use the oooctl control script or, depending on your system and installation method, start OOo running :
  • for Linux:
                -headless -nofirststartwizard
  • for Mac OS X:
                -headless -nofirststartwizard
  • for Windows:
    soffice.exe -headless

46.1.2. Parameters -headless

The -headless switch lets OOo manage to answer every question that may occur with a default response avoiding dead-locks. It also hides the OOo windows if a display is available by default (eg. Ms Windows). Note that the -invisible switch is not used as it is redundant and errors on PDF exports may occur. -nofirststartwizard

The -nofirststartwizard skips any post-install wizard, allowing to use OOo directly after the installation without any user parameterization.
Install nxSkipInstallWizard.oxt extension to make this parameter permanent. -accept

The UNO protocol implies that OOo is opened in listening mode on a network interface. This parameter let OOo listen on the right interface and port.
Install nxOOoAutoListen.oxt extension to set this listening permanent.
Alternate method: this could also be done by adding this connection info in OOo Setup.xcu configuration file.

46.1.3. Installing an extension

Nuxeo has developed some tools to ease the settings, they are available at the Nuxeo svn tools ooo section as extensions to install in OpenOffice. This can be done thru the GUI via the menu "Tools>Extensions Manager>Add..." or by opening the wanted extension with OpenOffice. To do it from a command line, run:
/path/to/openoffice/program/unopkg add extension.oxt

46.1.4. Notes Multi-machine

On multi-machine deployment, we recommend to install OOo on the server running the webapp (ie stateless server on a bi-machine "stateless/stateful" installation).
An opensource java based library  allows you to work with open office documents without open office, thus removing the need for the OOserver.
jOpenDocument is a free library for developers looking to use Open Document files without
jOpenDocument is Open Source (under GPL or commercial license).
You can automate the document creation and manipulation process. You can use jOpenDocument to:
  • Generate dynamic documents from Java, XML or databases
  • - Display and print files with built-in viewers
  • - Split, concatenate, and manipulate pages
  • Automate filling out of template (created by OpenOffice or not)
  • - Use your preferred langage via standard ScriptEngine interface
  • - And much more...

Web-based spreadsheets with and Dojo

Preparing is a cross-platform office suite. It is based on a component model called Universal Network Objects, or UNO, which allows components to communicate across the network oblivious to the platform they run on and the language they were written in. Though it's usually thought of as a desktop application, can be also run in server mode. In this mode, listens to a network port for connections. You can connect to an server running either on a local or remote computer and use the UNO environment to work with documents. UNO libraries for both client and server modes are part of the standard distribution. The libraries required for a client to access an server are:
  • juh.jar
  • jurt.jar
  • ridl.jar
  • unoil.jar
You can find these JAR files in the directory where you installed can be started in server mode and prepared to accept network connections with the following command line:
soffice -accept=socket,host=localhost,port=8100;urp
With the client libraries in the classpath, it then takes the client side several lines of code to construct an access point to the running -- an instance of the Java All application windows are organized in a hierarchy of frames that contain viewable components. The desktop is the root frame for this hierarchy. From the desktop, you can load viewable components, access frames and components, terminate the application, traverse the frame hierarchy, and dispatch command requests. class, which is a part of UNO, represents this desktop; thus, it is the root management point for all application frameworks.
If is running on a local computer, things are much easier; client libraries do most of the job, and they will even start for you, as shown in Listing 1.
READ MORE at link

No comments: