iText is only thread safe when one document = one thread. You need to copy the RAFoA or ensure only one thread has access at a time.
Or you could subclass RAFoA with thead-local state for everything that's getting stepped on. --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; > -----Original Message----- > From: dirk ooms [mailto:d...@onesparrow.com] > Sent: Thursday, July 22, 2010 3:54 AM > To: itext-questions@lists.sourceforge.net > Subject: [iText-questions] java.lang.InternalError > andRandomAccessFileOrArray > > Hello list, > > I am using itext for tiff to pdf conversion. In doing this I sometimes > obtain the below error. In fact it happens very rarely (like once in a > million conversions). I am using iText version 5.0.1. > > The line in my code that leads to this error is: > RandomAccessFileOrArray ra = new RandomAccessFileOrArray(filePath); > > Also, this is document independent. When I run the conversion again on > the document for which it failed earlier, everything goes fine. > > The process that does the conversions runs many threads, so this > RandomAccessFileOrArray constructor can be called by multiple threads at > the same time. > > So, looks like there is something not thread-safe. Should I have known > this or is this a bug? > > Thanks for any advice, > dirk > > > java.lang.InternalError > > at sun.nio.ch.Util.newMappedByteBufferR(Unknown Source) > > at sun.nio.ch.FileChannelImpl.map(Unknown Source) > > at > com.itextpdf.text.pdf.MappedRandomAccessFile.init(MappedRandomAccessFile .j > ava:98) > > at > com.itextpdf.text.pdf.MappedRandomAccessFile.<init>(MappedRandomAccessFi le > .java:82) > > at > com.itextpdf.text.pdf.RandomAccessFileOrArray.<init>(RandomAccessFileOrA rr > ay.java:125) > > at > com.itextpdf.text.pdf.RandomAccessFileOrArray.<init>(RandomAccessFileOrA rr > ay.java:79) > > at eu.xenit.poller.Tiff2Pdf.tiff2Pdf(Tiff2Pdf.java:76) > > > ------------------------------------------------------------------------ -- > ---- > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.itextpdf.com/book/ > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ > You can also search the keywords list: > http://1t3xt.info/tutorials/keywords/ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 9.0.851 / Virus Database: 271.1.1/3009 - Release Date: 07/21/10 > 23:36:00 ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/