cancel
Showing results for 
Search instead for 
Did you mean: 

OpenOffice connection works only when started manually

mike54
Champ in-the-making
Champ in-the-making
Hi!

My configuration:
Centos 5.3 + Tomcat
ALfresco 3.2
OpenOffice 2.3

When I run this command from terminal:
/usr/lib/openoffice.org/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager""-env:Userinstallation=file://var/lib/alfresco/alf_data/oouser" -nologo -headless -nofirststartwizard
I can see OpenOffice running on process list. When I start Tomcat / Alfresco it works well and I can see document preview for ODT files.

I have placed those lines in a config file:
ooo.exe=/usr/lib/openoffice.org/program/soffice
ooo.user=${dir.root}/oouser

But it does not start automatically and I get the well known warning:
15:20:39,702 WARN  [org.alfresco.util.OpenOfficeConnectionTester] An initial OpenOffice connection could not be established.

I have placed openoffice-startup-context.xml file in:
/var/lib/tomcat5/shared/classes/alfresco/extension/bootstrap

When it is wrongly configured (eg points to wrong location) it will report error in Alfresco log.
When i t is configured correctly - no errors in log, but OO connection is not available (nothing on process list as well.)

My  openoffice-startup-context.xml contents is as follows:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="openOfficeStartupBootstrap" class="org.alfresco.util.exec.RuntimeExecBootstrapBean" >
      <property name="startupCommands">
         <list>
            <ref bean="openOfficeStartupCommand" />
         </list>
      </property>

      <property name="failOnError">
         <value>false</value>
      </property>

   </bean>
   <bean id="openOfficeStartupCommand" class="org.alfresco.util.exec.RuntimeExec">
      <property name="commandMap">
          <map>
              <entry key=".*">
                  <value><![CDATA[/usr/lib/openoffice.org/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager""-env:Userinstallation=file://var/lib/alfresco/alf_data/oouser" -nologo -headless -nofirststartwizard]]></value>

              </entry>
          </map>
      </property>

      <property name="waitForCompletion">
         <value>false</value>
      </property>
      <property name="errorCodes">
         <value>2</value>
      </property>
   </bean>
</beans>

I have tried disabling SELinux and Firewall and any other thing that I could think of…
Please help!!!  :cry:
5 REPLIES 5

mike54
Champ in-the-making
Champ in-the-making
ok, I can see that nobody has any suggestions about it.
I know that many people have the same problem.
I'm not sure, but my guess for now is that "tomcat" user can't start this service for some reason.
When I run
sudo -u tomcat /usr/lib/openoffice.org/program/soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager""-env:Userinstallation=file://var/lib/alfresco/alf_data/oouser" -nologo -headless -nofirststartwizard
I will end up with:
Xlib: connection to ":1022.0" refused by server
Xlib: No protocol specified

/usr/lib/openoffice.org/program/soffice.bin X11 error: Can't open display:
   Set DISPLAY environment variable, use -display option
   or check permissions of your X-Server
   (See "man X" resp. "man xhost" for details)

For now I have no idea how to fix this, is it actually only a security problem?

Regards,
Maciej

dward
Champ on-the-rise
Champ on-the-rise
No, it's because the DISPLAY environment variable isn't set to point to an X server.

This shouldn't be required because the -headless option has been specified to ask the server to run without a display.

But I suspect your Open Office version doesn't support the -headless option. Please upgrade to the latest version of OpenOffice.

mike54
Champ in-the-making
Champ in-the-making
hi, thank you for your input.
I'm running OpenOffice 2.3 and I have read that OpenOffice 3.1 has even more problems with the headless option on Centos 5.3?
I will try to do that anyway…

One more thing. When I run soffice.bin directly (instead of soffice) I get this error:

[root@alfresco WEB-INF]# sudo -u tomcat /usr/lib/openoffice.org/program/soffice.bin "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager""-env:Userinstallation=file://var/lib/alfresco/alf_data/oouser" -nologo -headless -nofirststartwizard
creation of executable memory area failed: Permission denied
FATAL ERROR, could not mmap a file for executable memory either in home dir or in /tmp
Cannot continue, perhaps examine your mount options for those directories, or selinux

When I run it as root - it works fine and Alfresco can display previews of ODT etc.

mike54
Champ in-the-making
Champ in-the-making
UPDATE:
I have installed OpenOffice 3.1 from OO website.
The situation is actually the same - it works great when I start it manually as ROOT, and then restart Alfresco / Tomcat.
But it won't start on its own (with the bootstrap file)…

I think for now the only alternative for me is to use this approach:
http://forums.alfresco.com/en/viewtopic.php?f=9&t=15637

mike54
Champ in-the-making
Champ in-the-making
Ok, I did give up the idea of starting OO by Alfresco.
To fix the problem I have created shell script and added OO as system service that starts automatically.
It is run under ROOT account with headless option.

Sometimes it is important to use "unset DISPLAY" before starting the service.
Now the connection works perfectly.