pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Gamache <cgama...@gmail.com>
Subject PDFBox JPEG2000 and Tomcat
Date Fri, 21 Jul 2017 19:28:38 GMT
Hi all,

I'm using PDFBox 2.0.7 to extract pages from PDFs, convert them to images
and stream them back out.

I have included

<dependency>
<groupId>com.levigo.jbig2</groupId>
<artifactId>levigo-jbig2-imageio</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
<version>1.3.0</version>
</dependency>

I can fire up tomcat and everything works fine... The next day at some
point I get

ERROR 15:11:13,114 [http-nio-8080-exec-1 PDFStreamEngine] - Cannot read
JPEG2000 image: Java Advanced Imaging (JAI) Image I/O Tools are not
installed

which boggles my mind! They were just there. How could they disappear? Of
course, after a restart everything is fine again-- until next time.

Disk space is fine. RAM is fine. Swap is fine. Nothing else seems adversely
affected.

The way I see it working is:

org.apache.pdfbox.filter.JPXFilter#readJPX
calls org.apache.pdfbox.filter.Filter#findImageReader and that then
iterates over an ImageReader collection provided
by javax.imageio.ImageIO#getImageReadersByFormatName ...

That collection is contained in a singleton IIORegistry obtained from
javax.imageio.spi.IIORegistry#getDefaultInstance.

When that IIORegistry is constructed, it walks the classpath looking for
service provider instances
in javax.imageio.spi.IIORegistry#registerApplicationClasspathSpis ...

It obviously finds the JPEG2000 SPI early on, but then forgets it later. I
can't see how that would be possible, or how to remedy it!

Please help!

Thanks so much,

CG

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message