由于服务器的问题将原有的Ubuntu 32位系统换成CentOs6.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...... 但是错误仍然依旧,没有明确的解决方案。也有一些资料说是权限问题,改过就好了,但试过后没有效果。于是就想着换个版本,然后奇迹就出现了。