我正在尝试在 debian 机器上配置 docsplit。安装所有依赖项后,我尝试从命令行运行一个简单的转换,以确保它正常工作。我不断收到 jodconverter 的以下错误:
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: java.lang.NoSuchMethodError: method java.util.regex.Pattern.quote wit signature (Ljava.lang.String;)Ljava.lang.String; was not found.
at java.util.concurrent.FutureTask$Sync.innerGet(libgcj.so.90)
at java.util.concurrent.FutureTask.get(libgcj.so.90)
at org.artofsolving.jodconverter.office.ManagedOfficeProcess.startAndWait(ManagedOfficeProcess.java:62)
...3 more
Caused by: java.lang.NoSuchMethodError: method java.util.regex.Pattern.quote with signature (Ljava.lang.String;)Ljava.lan.String; was not found.
at org.artofsolving.jodconverter.process.LinuxProcessManager.findPid(LinuxProcessManager.java:51)
at org.artofsolving.jodconverter.office.OfficeProcess.start(OfficeProcess.java:65)
at org.artofsolving.jodconverter.office.OfficeProcess.start(OfficeProcess.java:60)
at org.artofsolving.jodconverter.office.ManagedOfficeProcess.doStartProcessAndConnect(ManagedOfficeProcess.java:119)
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(libgcj.so.90)
at java.util.concurrent.FutureTask$Sync.innerRun(libgcj.so.90)
at java.util.concurrent.FutureTask.run(libgcj.so.90)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(libgcj.so.90)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(libgcj.so.90)
at java.lang.Thread.run(libgcj.so.90)
我已经尝试在无头模式下启动 openoffice 并使用以下 hte
/usr/bin/soffice -headless -accept="socket,host=127.0.0.1,port=2002;urp"
编辑:
我通过删除当前的 OpenOffice 安装并从download.openoffice.org获取最新的软件包解决了上述问题
我使用 docsplit gem 附带的 jodconverter jar 成功地将 nd odt 文件转换为 pdf,如下所示:
java -jar /usr/lib/ruby/gems/1.8/gems/docsplit-0.6.3/vendor/jodconverter/jodconverter-core-3.0-beta-4.jar test.odt test.pdf
不幸的是,我仍然遇到 docsplit 的问题。如果我尝试在命令行中使用 docsplit 从 odt 文件中提取图像,如下所示:
docsplit images test.odt --format jpg
我从 jodconverter 收到以下错误:
Exception in thread "main" org.artofsolving.jodconverter.office.OfficeException: could not load document: test.odt
at org.artofsolving.jodconverter.AbstractConversionTask.loadDocument(AbstractConversionTask.java:92)
at org.artofsolving.jodconverter.AbstractConversionTask.execute(AbstractConversionTask.java:59)
at org.artofsolving.jodconverter.office.PooledOfficeManager$2.run(PooledOfficeManager.java:80)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one.
at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:177)
at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:143)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:335)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:304)
at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:91)
at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:639)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:151)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:133)
at $Proxy4.loadComponentFromURL(Unknown Source)
at org.artofsolving.jodconverter.AbstractConversionTask.loadDocument(AbstractConversionTask.java:90)
... 8 more
任何输入将不胜感激。
-谢谢