officeHome not set and could not be auto-detected

7,495 views
Skip to first unread message

Francis Lewis

unread,
Oct 14, 2011, 3:19:21 PM10/14/11
to JODConverter
I'm having trouble getting this working on a server running CentOS
5.3, installed using YUM.
When I run: whereis openoffice.org, my results are:
openoffice: /usr/bin/openoffice.org /usr/share/openoffice.org

When I run the converter, this is what I get:
java -jar jodconverter-core-3.0-beta-4/lib/jodconverter-core-3.0-
beta-4.jar test.doc test.txt

Exception in thread "main" java.lang.IllegalStateException: officeHome
not set and could not be auto-detected
at
org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration.buildOfficeManager(DefaultOfficeManagerConfiguration.java:
163)
at org.artofsolving.jodconverter.cli.Convert.main(Convert.java:
111)

Where is this looking for the openoffice binary?

Thanks,

Francis Lewis

unread,
Oct 14, 2011, 4:42:03 PM10/14/11
to JODConverter
After looking through the source code of JODConverter, I found it
searches in 4 locations for officehome:
"/opt/openoffice.org3",
"/opt/libreoffice",
"/usr/lib/openoffice",
"/usr/lib/libreoffice"

In CentOS (through YUM), openoffice is installed in: /usr/lib64/
openoffice.org3.

So after adding a symlink and running the converter again, I get this:
Oct 14, 2011 3:34:28 PM
org.artofsolving.jodconverter.office.ProcessPoolOfficeManager <init>
INFO: ProcessManager implementation is LinuxProcessManager
Oct 14, 2011 3:34:28 PM
org.artofsolving.jodconverter.office.OfficeProcess start
INFO: starting process with acceptString
'socket,host=127.0.0.1,port=2002,tcpNoDelay=1' and profileDir '/
tmp/.jodconverter_socket_host-127.0.0.1_port-2002'
Oct 14, 2011 3:34:28 PM
org.artofsolving.jodconverter.office.OfficeProcess start
INFO: started process; pid = 21813
Exception in thread "main"
org.artofsolving.jodconverter.office.OfficeException: failed to start
and connect
at
org.artofsolving.jodconverter.office.ManagedOfficeProcess.startAndWait(ManagedOfficeProcess.java:
64)
at
org.artofsolving.jodconverter.office.PooledOfficeManager.start(PooledOfficeManager.java:
101)
at
org.artofsolving.jodconverter.office.ProcessPoolOfficeManager.start(ProcessPoolOfficeManager.java:
62)
at org.artofsolving.jodconverter.cli.Convert.main(Convert.java:
112)
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)
... 3 more
Caused by: org.artofsolving.jodconverter.office.OfficeException: could
not establish connection
at
org.artofsolving.jodconverter.office.ManagedOfficeProcess.doStartProcessAndConnect(ManagedOfficeProcess.java:
142)
at
org.artofsolving.jodconverter.office.ManagedOfficeProcess.access
$000(ManagedOfficeProcess.java:31)
at org.artofsolving.jodconverter.office.ManagedOfficeProcess
$1.run(ManagedOfficeProcess.java:58)
at java.util.concurrent.Executors
$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask
$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1110)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: org.artofsolving.jodconverter.office.OfficeException:
office process died with exit code 0
at org.artofsolving.jodconverter.office.ManagedOfficeProcess
$6.attempt(ManagedOfficeProcess.java:136)
at
org.artofsolving.jodconverter.office.Retryable.execute(Retryable.java:
40)
at
org.artofsolving.jodconverter.office.Retryable.execute(Retryable.java:
30)
at
org.artofsolving.jodconverter.office.ManagedOfficeProcess.doStartProcessAndConnect(ManagedOfficeProcess.java:
120)
... 8 more


So looking further into openoffice to see if I can start it through
command line:
$ soffice -invisible

The result:
/usr/lib64/openoffice.org3/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)

Francis Lewis

unread,
Oct 14, 2011, 5:01:48 PM10/14/11
to JODConverter
And after tracking down this error, I found that I needed to install
the headless package, so I ran:
sudo yum install openoffice.org-headless

And now the converter works beautifully!

Brenden Palmer

unread,
Oct 24, 2012, 5:48:21 PM10/24/12
to jodcon...@googlegroups.com, ftu...@gmail.com
I am having the same problem you had, listed below:

Exception in thread "main" java.lang.IllegalStateException: officeHome not set and could not be auto-detected

I am upgrading from version 2.2.2, everything worked perfectly in that version.  What exactly did you do to get this fixed?  Like you I am running centOS with Open Office installed via YUM...
Reply all
Reply to author
Forward
0 new messages