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.
=============================
javaworld.com/community/?q=node/2993
To start openoffice3 in server mode, use this
soffice -headless accept="socket,host=localhost,port=8100;urp" &
------------------------------------------------
=============================
community.nuxeo.com
youtube.com/watch?v=FJglLZuU_hI 
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.
http://community.nuxeo.com/5.3/books/nuxeo-book/html/admin-openoffice.html
See http://www.openoffice.org/ 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:
    /path/to/openoffice/program/soffice.bin
                -headless -nofirststartwizard
                -accept="socket,host=localhost,port=8100;urp;StarOffice.Service"
  • for Mac OS X:
    /path/to/openoffice.app/Contents/MacOS/soffice.bin
                -headless -nofirststartwizard
                -accept="socket,host=localhost,port=8100;urp;StarOffice.Service"
  • for Windows:
    soffice.exe -headless
                -nofirststartwizard
                -accept="socket,host=localhost,port=8100;urp;StarOffice.Service"

46.1.2. Parameters

46.1.2.1. -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.

46.1.2.2. -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.

46.1.2.3. -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.
oor:name="Office"> 
  oor:name="ooSetupConnectionURL"> 
    socket,host=localhost,port=8100;urp;StarOffice.Service 
   

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

46.1.4.1. 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 OpenOffice.org.
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 OpenOffice.org and Dojo

Preparing OpenOffice.org

OpenOffice.org 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, OpenOffice.org can be also run in server mode. In this mode, OpenOffice.org listens to a network port for connections. You can connect to an OpenOffice.org 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 OpenOffice.org distribution. The libraries required for a client to access an OpenOffice.org server are:
  • juh.jar
  • jurt.jar
  • ridl.jar
  • unoil.jar
You can find these JAR files in the directory where you installed OpenOffice.org.
OpenOffice.org 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 OpenOffice.org -- an instance of the Java classcom.sun.star.frame.Desktop. All OpenOffice.org 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. Thecom.sun.star.frame.Desktop class, which is a part of UNO, represents this desktop; thus, it is the root management point for all OpenOffice.org application frameworks.
If OpenOffice.org is running on a local computer, things are much easier; client libraries do most of the job, and they will even start OpenOffice.org for you, as shown in Listing 1.
READ MORE at link

No comments: