No, there is no close() in the process. But the process is runing inside
a threaded environnement; the File.createTempFile seems thread safe, but
I do not trust the Weblogic jvm…
The problem is : how to check if :
* the file is deleted by the java process
* the file is deleted by the environemnt (cron job, another
application)
* the file has never existed
You should use a temporary directory which you can control. JavaVM won't
delete the file even if it is created as temp file.
Failing to create the temp file would result in a different exception.
PDFBox is not thread safe. Each thread needs its own instance. Thus
processing a document should be done in a single thread but you can
process multiple documents in parallel with one instance per thread.
Timo
Am 11.10.2012 15:15, schrieb Sébastien Dailly:
We are encountering some errors with pdfbox on a AIX platform. We
don't know how to reproduce the problem, neither how to explain it…
The stacktrace here :
java.io.IOException: No such file or directory
at
org.apache.pdfbox.io.RandomAccessFile.length(RandomAccessFile.java:83)
at
org.apache.pdfbox.io.RandomAccessFileOutputStream.<init>(RandomAccessFileOutputStream.java:52)
at org.apache.pdfbox.cos.COSStream.doDecode(COSStream.java:300)
The RandomAccessFile is created by the constructor
COSDocument(File scratchDir, boolean forceParsingValue) which is called
by PDFParser.parse() if you've set a temporary directory via
PDFParser.setTempDirectory( File tmpDir ).
It will create a temporary file in the temp dir and provides this file
to RandomAccessFile.
If something went wrong until this point you would have got an exception
already. Thus the file existed but your exception shows it is missing at
a certain point. The only case the temporary file is deleted is when
calling COSDocument.close().
So I assume you have such close() call within your program before file
processing is finished.
No, there is no close() in the process. But the process is runing inside
a threaded environnement; the File.createTempFile seems thread safe, but
I do not trust the Weblogic jvm…
The problem is : how to check if :
* the file is deleted by the java process
* the file is deleted by the environemnt (cron job, another
application)
* the file has never existed
Thanks,
--
Timo Boehme
OntoChem GmbH
H.-Damerow-Str. 4
06120 Halle/Saale
T: +49 345 4780474
F: +49 345 4780471
timo.boe...@ontochem.com
_____________________________________________________________________
OntoChem GmbH
Geschäftsführer: Dr. Lutz Weber
Sitz: Halle / Saale
Registergericht: Stendal
Registernummer: HRB 215461
_____________________________________________________________________