64位 CentOS 6.3 安装 Libreoffice 4.1.1

由于服务器的问题将原有的Ubuntu 32位系统换成CentOS 6.3 64位的,在装libreoffice是遇到了一些问题。

首先,安装的libreoffice的版本是LibreOffice_4.1.2.3_Linux_x86_rpm(具体安装的步骤在此省略,因为安装后有问题),安装后系统的默认目录是/usr/lib64/libreoffice(ubuntu 32位中是在/usr/lib/libreoffice).项目中通过命令调用libreoffice转换文档(doc,docx,pdf,txt,excel....)生产pdf文档,然后再将pdf转换成swf文件,使其能够在网页上浏览(doc,docx,pdf,txt,excel....--->pdf-->swf)

后台调用libreoffice时,抛出的异常是:

Exception in thread "main" org.artofsolving.jodconverter.office.OfficeException: failed to start and connect
at org.artofsolving.jodconverter.office.ManagedOfficeProcess.stopAndWait(ManagedOfficeProcess.java:77)
at org.artofsolving.jodconverter.office.PooledOfficeManager.stop(PooledOfficeManager.java:108)
at org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.stop(ProcessPoolOfficeManager.java:91)
at com.lexmark.pws.aps.pe.handler.impl.OfficeConnectorUtil.closeConnection(OfficeConnectorUtil.java:86)
at com.lexmark.pws.aps.pe.ThumbnailEngine.main(ThumbnailEngine.java:65)


Caused by: java.util.concurrent.ExecutionException: org.artofsolving.jodconverter.office.OfficeException: could not establish connection
          at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
          at java.util.concurrent.FutureTask.get(FutureTask.java:111)
          at org.artofsolving.jodconverter.office.ManagedOfficeProcess.startAndWait(ManagedOfficeProcess.java:62)
          ... 79 more
 Caused by: org.artofsolving.jodconverter.office.OfficeException: could not establish connection
          at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doStartProcessAndConnect(ManagedOfficeProcess.java:142)

但是在网上查找了很多资料,重新安装、卸载、安装相关package......    但是错误仍然依旧,没有明确的解决方案。也有一些资料说是权限问题,改过就好了,但试过后没有效果。于是就想着换个版本,然后奇迹就出现了。

Step 1: 下载LibreOffice 4.1.1
For RHEL/CentOS/Fedora 32-Bit
# cd /tmp
# wget http://download.documentfoundation.org/libreoffice/stable/4.1.1/rpm/x86/LibreOffice_4.1.1_Linux_x86_rpm.tar.gz
For RHEL/CentOS/Fedora 64-Bit
# cd /tmp
# wget http://download.documentfoundation.org/libreoffice/stable/4.1.1/rpm/x86_64/LibreOffice_4.1.1_Linux_x86-64_rpm.tar.gz

Step 2: 删除已安装的libreoffice or openoffice
# yum remove openoffice.org* libreoffice.org*

Step 3: 解压LibreOffice 4.1.1 安装包
## For 32-Bit OS ##
# tar -xvf LibreOffice_4.1.1_Linux_x86_rpm.tar.gz

## For 64-Bit OS ##
# tar -xvf LibreOffice_4.1.1_Linux_x86-64_rpm.tar.gz


Step 4: 安装 LibreOffice 4.1.1 Package
## For 32 Bit OS ##
# cd /tmp/LibreOffice_4.1.1_Linux_x86_rpm/RPMS/
# yum localinstall *.rpm
# yum localinstall desktop-integration/libreoffice4.0-freedesktop-menus-4.1.1*.noarch.rpm

## For 64 Bit OS ##
# cd /tmp/LibreOffice_4.1.1_Linux_x86-64_rpm/RPMS/
# yum localinstall *.rpm
# yum localinstall desktop-integration/libreoffice4.0-freedesktop-menus-4.1.1*.noarch.rpm
PS: libreoffice4.0-freedesktop-menus-4.1.1*.noarch.rpm的路径问题:有的位于RPMS/desktop-integration目录下,有的位于RPMS下.不过,无论在那个目录下,直接安装就可以了.

Step 5: 在terminal中启动 LibreOffice 4.1.1
# libreoffice4.1

综上所述,解决这个问题的方法就是换了个版本,具体是什么问题引起的,没有找到. 如果有找到的朋友,可以分享一下解决方法。

LibreOffice 的详细介绍:请点这里
LibreOffice 的下载地址:请点这里

推荐阅读:

相关推荐