Issue 100613

Summary: Add support for registering OpenOffice as a Windows service
Product: Installation Reporter: oharboe <oyvind.harboe>
Component: codeAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, kay.ramme
Version: OOO310m7   
Target Milestone: ---   
Hardware: Unknown   
OS: Windows, all   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---

Description oharboe 2009-03-27 15:30:56 UTC
When deploying OpenOffice in headless server mode it is necessary to launch
OpenOffice as a service.

I'd like to see an installation option to register OpenOffice as a service.
Below is a manual recipie to to this and needless to say it's quite involved.


<h2>Running OpenOffice as a service under Windows</h2>
The net is rife with recipies on how to do this and there may be
some simpler way of doing this, but as of writing this is the
recommended approach:


<ol>
<li>Download and install <strong>OpenOffice.org</strong> on your computer.</li>
<li>Create a user for service, e.g. <tt>openoffice</tt>.</li>

<li>Run <strong>OpenOffice.org</strong> as <tt>openoffice</tt>. Right on
shortcut to <em>OpenOffice.org &gt; Run as&#8230;</em></li>
<li>Go through the first run wizard. Close <strong>OpenOffice.org</strong>.</li>
<li>Open <em>Control Panel &gt; Administrative Tools &gt; Local Security
Policy</em>.</li>

<li>Open <em>Security Settings &gt; Local Policies &gt; User Right Assigment
&gt; Log on as a service</em>. Add <tt>openoffice</tt>.</li>
<li>Download and install <strong>Windows Server 2003 Resource Kit
Tools</strong>. rktools.exe works on Windows XP Professional as well.</li>
<li>Read <a href="http://support.microsoft.com/kb/q137890/">How To Create a
User-Defined Service</a>.</li>

<li>Create a service named <tt>OpenOfficeService</tt> following the instructions
above. As the <tt>Application</tt> registry value use <tt>C:\Program
Files\OpenOffice.org 3.0\program\soffice.exe</tt>.</li>
<li>Add another value to the <tt>Parameters</tt> key named
<tt>AppParameters</tt> and set it to:
<ul>
<li><tt>-headless -accept=socket,port=2002;urp;</tt><br />
if you what to allow <strong>OpenOffice.org</strong> accept connections only
from localhost,</li>

<li><tt>-headless -accept=socket,host=0.0.0.0,port=2002;urp;</tt><br />
if you what to allow <strong>OpenOffice.org</strong> accept connections from any
computer.</li>
</ul>
</li>
<li>Open <em>Control Panel &gt; Administrative Tools &gt; Services</em>.</li>

<li>Find <tt>OpenOfficeService</tt> and open its properties.</li>
<li>On <em>Log On</em> tab set <em>Log on as: This account</em> and specify
<tt>openoffice</tt>.</li>
<li>Start service.</li>
</ol>

<div>Some notes:</div>
<div>
<ul>
<li>To check is our service running from a command prompt do:<br />
<code>&gt; netstat -anp tcp</code><br />
This shoud show a listening on port 2002.</li>
<li>If you use firewall, you may need to allow connections to port 2002.</li>
<li>You can remove <tt>openoffice</tt> from group <tt>Users</tt> to deny local
log in for this user.</li>

</ul>
</div>

<h2>OpenOffice as a service troubleshooting</h2>
If conversion fails, then it might be because OpenOffice is trying to open some sort
of dialog box. Create an icon on the desktop with the argumetns above.
<p>
Create an shortcut on the desktop with the following arguments and right click and
"Run as" using the openoffice user. This will enable you to see the dialog boxes
that OpenOffice is trying to show.
<p>
<code>
"C:\Program Files\OOo-dev 3\program\soffice.exe" 
-accept=socket,host=localhost,port=2002;urp;
</code>
<h2>OpenOffice advanced configuration</h2>
You can configure the openoffice service to restart upon failure. Right click on 
services and enter the "Recovery" tab. Here you can set the service to restart
upon failure. However, this will fail as long as the srvany.exe application is
running. As of writing a there is no known method to make srvany.exe take advantage
robustly of the "Recovery" tab options.
Comment 1 Olaf Felka 2009-03-27 15:36:22 UTC
@ sb: Something for you?
Comment 2 oharboe 2009-03-27 15:45:24 UTC
Another comment regarding use of OpenOffice from Java:

one application(ours) is to convert files to PDF. This is done en masse in order
to be able to use e.g. Apache Lucene + Apache PDFBox to index & search files of
all sorts of different types.

Ideally I'd like to have a big openoffice.jar that I simply add to my
application like any other .jar file that I use for my application.

Comment 3 Stephan Bergmann 2009-03-27 16:14:25 UTC
@kso: please dispatch
Comment 4 kai.sommerfeld 2009-04-02 12:26:51 UTC
oharboe: Please don't use one single issue to report/request completely
unrelated fixes/features. Feel free to submit a seperate RFE for the OOo-Java
problem. But this task will only deal with the Windows-OOo-Service thing - as
its subject indicates.

ohraboe: Thanks for the recipe, much appreciated.

dv: Please take over. 
Comment 5 kai.sommerfeld 2009-04-02 12:31:00 UTC
.
Comment 6 dirk.voelzke 2009-04-09 07:05:07 UTC
Accepted.