Jodconverter sometimes OK sometimes or NOT?

318 views
Skip to first unread message

Fongming

unread,
Jul 8, 2009, 10:29:13 PM7/8/09
to JODConverter
Hi, All!!

I use Jodconverter in command line to convert documents like DOC to
PDF,or PPT to PDF.

I found sometims it can work, but at other times it will fail,
I don't know why?

I write the commands in PHP like:
-------------------------------------------------------------------------------------------

$exec_string2=" /usr/bin/java -jar jodconverter-cli-2.2.2.jar 001.doc
001.pdf";

$exec_string3="killal soffice.bin";

exec($exec_string2);
exec($exec_string3);

----------------------------------------------------------------------------------------------

My platform is Linux core 7, Apache5, PHP5, jodconverter 2.2.2.

Thanks form Any help.

Fongming, 2009-7-9

Mirko Nasato

unread,
Jul 9, 2009, 3:54:48 AM7/9/09
to jodcon...@googlegroups.com
Hi Fongming,

You need to provide a more detailed description of your problem if you
want help. How am I supposed to know why "it will fail" if you don't
even say what error you get?

Kind regards

Mirko


2009/7/9 Fongming <fongmi...@gmail.com>:

Fongming

unread,
Jul 9, 2009, 7:08:43 PM7/9/09
to JODConverter
Thanks for Mirko cared about me.

I did 2 experiments to test JODConverter in my Linux core7,
jodconverter-2.2.2 using CLI command.
I tried to use for loop in converting DOC to PDF for 100 times.
one is in PHP script, another is in Shell script.
-----------------------------------------------------------------------------------------------------------------------------------------------
I found that JODConverter could only succeed in the convertering
work less than 50 times.
-----------------------------------------------------------------------------------------------------------------------------------------------
Is it a problem about stability for the System or JODConverter?
What shuold I do.........


##################
# Experiment 1 : #
##################
Because in PHP, I couldn't show the errors for JODConverter,
I checked whether the PDF file existed in the folder or not.
the following is the PHP script:

<?php

$my_doc_file="002.doc";
set_time_limit(0);
mt_srand((double)microtime()*1000000);
$k = mt_rand(10000,99999);
$my_date=date("U");

$convert_bin="/usr/bin/java -jar jodconverter-cli-2.2.2.jar ";
$tmp_dir="/var/www/html/class_web/s_pic/tmp/";

$k=0;
for($i=0;$i<100;$i++)
{
$new_doc_name="002.doc";
$new_pdf_name=$my_date.$k."_".$i.".pdf";

$exec_string=" ".$convert_bin." ".$tmp_dir.$new_doc_name." ".
$tmp_dir.$new_pdf_name;
exec($exec_string);

if(file_exists($tmp_dir.$new_pdf_name))
{
echo "The".$i.", convert OK<BR>";
}
else
{
$k++;
echo "<font color=red>The".$i.", convert failed!</
font><BR>";
}
sleep(1);
flush();
}
echo "total:".$k."errors";

?>
##################
# THT RESULT: #
##################
.........
The89, convert failed!
The90, convert failed!
The91, convert OK
The92, convert OK
The93, convert failed!
The94, convert OK
The95, convert failed!
The96, convert failed!
The97, convert failed!
The98, convert failed!
The99, convert failed!

total:62errors

-----------------------------------------------------------------------------------------------------------------------------
The first time, I got 52 errors.
The second time, I got 57 errors.
The third time, I got 62 errors

I didn't know why......

-----------------------------------------------------------------------------------------------------------------------------

So I did experiment 2 in the Shell Script to look the error
informations:


##################
# Experiment 2 : #
##################


the following is the Schell Script:

-----------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh

for kk in $(seq 1 100)
do
#echo "ok ${kk}";
/usr/bin/java -jar /var/www/html/ffmpeg/jodconverter-2.2.2/lib/
jodconverter-cli-2.2.2.jar /var/www/html/class_web/s_pic/tmp/002.doc /
var/www/html/class_web/s_pic/tmp/002.pdf
done
-------------------------------------------------------------------------------------------------------------------------------------------------------
##################
# THT RESULT: #
##################

It also could not succeed in every time,
I found some erros are "connection failed:
socket,host=localhost,port=8100,tcpNoDelay=1"
some erros are "could not obtain service:
com.sun.star.ucb.FileContentProvider"
some errors are "conversion failed: could not save output
document"

and I cut the errors show below :
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INFO: connected
10- 7?-09 6:53:05 ??
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection
disposing
INFO: disconnected
10- 7?-09 6:53:06 ??
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection
connect
INFO: connected
10- 7?-09 6:53:06 ??
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection
disposing
INFO: disconnected
Exception in thread "main"
com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException:
could not obtain service: com.sun.star.ucb.FileContentProvider
at
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.getService
(AbstractOpenOfficeConnection.java:119)
at
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.getFileContentProvider
(AbstractOpenOfficeConnection.java:129)
at
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.convertInternal
(OpenOfficeDocumentConverter.java:116)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:104)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:74)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:70)
at com.artofsolving.jodconverter.cli.ConvertDocument.convertOne
(ConvertDocument.java:154)
at com.artofsolving.jodconverter.cli.ConvertDocument.main
(ConvertDocument.java:133)
Caused by: java.lang.NullPointerException
at com.sun.star.lib.uno.protocols.urp.urp.writeRequest(urp.java:
119)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest
(java_remote_bridge.java:643)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.request(ProxyFactory.java:154)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.invoke(ProxyFactory.java:136)
at $Proxy1.createInstanceWithContext(Unknown Source)
at
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.getService
(AbstractOpenOfficeConnection.java:117)
...7 more
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exception in thread "main"
com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException:
connection failed: socket,host=localhost,port=8100,tcpNoDelay=1
at
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect
(AbstractOpenOfficeConnection.java:81)
at com.artofsolving.jodconverter.cli.ConvertDocument.main
(ConvertDocument.java:123)
Caused by: java.lang.NullPointerException
at com.sun.star.lib.uno.protocols.urp.urp.writeRequest(urp.java:
119)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest
(java_remote_bridge.java:643)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.request(ProxyFactory.java:154)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.invoke(ProxyFactory.java:131)
at $Proxy1.queryInterface(Unknown Source)
at com.sun.star.uno.UnoRuntime.queryInterface(UnoRuntime.java:156)
at com.sun.star.uno.UnoRuntime.queryInterface(UnoRuntime.java:183)
at
com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.connect
(AbstractOpenOfficeConnection.java:73)
...1 more
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Exception in thread "main" java.lang.NullPointerException
at com.sun.star.lib.uno.protocols.urp.urp.writeRequest(urp.java:
119)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest
(java_remote_bridge.java:643)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.request(ProxyFactory.java:154)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.invoke(ProxyFactory.java:136)
at $Proxy4.getFileURLFromSystemPath(Unknown Source)
at
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.convertInternal
(OpenOfficeDocumentConverter.java:117)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:104)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:74)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:70)
at com.artofsolving.jodconverter.cli.ConvertDocument.convertOne
(ConvertDocument.java:154)
at com.artofsolving.jodconverter.cli.ConvertDocument.main
(ConvertDocument.java:133)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exception in thread "main"
com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException:
conversion failed: could not save output document
at
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.loadAndExport
(OpenOfficeDocumentConverter.java:144)
at
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.convertInternal
(OpenOfficeDocumentConverter.java:120)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:104)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:74)
at
com.artofsolving.jodconverter.openoffice.converter.AbstractOpenOfficeDocumentConverter.convert
(AbstractOpenOfficeDocumentConverter.java:70)
at com.artofsolving.jodconverter.cli.ConvertDocument.convertOne
(ConvertDocument.java:154)
at com.artofsolving.jodconverter.cli.ConvertDocument.main
(ConvertDocument.java:133)
Caused by: java.lang.NullPointerException
at com.sun.star.lib.uno.protocols.urp.urp.writeRequest(urp.java:
119)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest
(java_remote_bridge.java:643)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.request(ProxyFactory.java:154)
at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory
$Handler.invoke(ProxyFactory.java:136)
at $Proxy9.close(Unknown Source)
at
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.storeDocument
(OpenOfficeDocumentConverter.java:161)
at
com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter.loadAndExport
(OpenOfficeDocumentConverter.java:140)
...6 more

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

at last, thanks for any one could help me to understand them.

Mirko Nasato

unread,
Jul 10, 2009, 3:06:03 AM7/10/09
to jodcon...@googlegroups.com
Hi Fongming,

The command line tool is not intended to be invoked by multiple
threads concurrently. It's a very simple tool intended mainly as a way
to test the Java library. If you're using JODConverter from a language
other than Java you should adopt the web service approach

http://www.artofsolving.com/node/15

Kind regards

Mirko


2009/7/10 Fongming <fongmi...@gmail.com>:

Fongming

unread,
Jul 10, 2009, 1:07:46 PM7/10/09
to JODConverter
Hi Mirko :

Thanks for your kind suggestions.
Before your replied , I haven't noticed the way to the web service.
I tried to solve the convertering failed problem using the for loop
script like following:
----------------------------------------------------------------------------------------------------------------
$exec_command = "java -jar JODConverter.2.2.2.jar 001.doc 001.pdf";

// if the script check 001.pdf ,and 001.pdf doesn't exist, keep
convertering.......

while(!file_exists("001.pdf))
{
exec($exec_command);
}
------------------------------------------------------------------------------------------------------------------

But it wasn't a good way after all.
I'll try the web service soon.

Thanks a lot.

Fongming 2009-7-11
Reply all
Reply to author
Forward
0 new messages