Wild guess. Does this library use tmp to extract binaries to run native
code?

If so, it might be a version collision of those tmp binaries?



On Sat, Apr 12, 2025 at 4:23 PM Thad Humphries <thad.humphr...@gmail.com>
wrote:

> I have a problem that appears to be one webapp in Tomcat 9 having a portion
> of its classpath masked by another webapp. I am running Tomcat 9 (versions
> see below) on macOS 15.4 with Amazon's OpenJDK 11.0.22+7-LTS.
>
> I have 3 webapps all of which use PDFBox 2 and jai-imageio-core
> (standalone) v1.4.0, largely for converting pages of a PDF to a Java
> BufferedImage and then to PNG for display in a browser. None of these
> webapps use com.twelvemonkeys.imageio.
>
> Last week I was presented with a PDF with JPEG2000 images on some pages.
> Having no luck on a command line with PDFBox 2 and jai-imageio-jpeg2000, I
> tried PDFBox 3. That worked so I updated my most recent app to PDFBox 3 and
> added jai-imageio-jpeg2000. That worked fine from NetBeans and the Tomcat
> 9.0.67 dev server. However when I deployed my app to Tomcat 9.0.80 with the
> other two apps, the JPEG2000 images failed, producing this in my app's log:
>
> ERROR PDFStreamEngine.operatorException() - Cannot read JPEG2000 image:
> Java Advanced Imaging (JAI) Image I/O Tools are not installed
> org.apache.pdfbox.filter.MissingImageReaderException: Cannot read JPEG2000
> image: Java Advanced Imaging (JAI) Image I/O Tools are not installed
> at org.apache.pdfbox.filter.Filter.findImageReader(Filter.java:171)
> ~[pdfbox-3.0.4.jar:3.0.4]
> ...
>
> Both jai-imageio-core and jai-imageio-jpeg2000 are in WEB-INF/lib so why
> wasn't JPEG2000 found?
>
> I downloaded Tomcat 9.0.104 and deployed my new app. The JPEG2000 images
> were fine. I installed one of the older apps via manager, and my new app
> still worked. I restarted Tomcat and the images failed. Then I copied
> jai-imageio-jpeg2000 to the old app's WEB-INF/lib, restarted Tomcat, and
> the JPEG2000 images were again fine.
>
> I've since tried this test with both 9.0.80 and 9.0.104 and see the same
> results. Interestingly, on startup I see the older app's deployment
> descriptor loads first in catalina.out. I understand the order is
> non-deterministic, but it appears that if the first webapp with
> jai-imageio-core does not jai-imageio-jpeg2000 with it, the second app
> can't find jai-imageio-jpeg2000 in its WEB-INF/lib.
>
> I know jai-imageio in webapps is a strange beast, going back to the
> original Sun versions and Tomcat 4 and 5. When I was running TwelveMonkeys
> I had a special context listener for that library, but I dropped that
> library years ago because jai-imageio-core standalone was all I needed.
>
> Any thoughts, ideas, or known problems with the combinations I've described
> above? Any solutions other than copying jai-imageio-jpeg2000 to the other
> apps' WEB-INF/lib?
>
> --
> "Hell hath no limits, nor is circumscrib'd In one self-place; but where we
> are is hell, And where hell is, there must we ever be" --Christopher
> Marlowe, *Doctor Faustus* (v. 111-13)
>

Reply via email to