1
votes

I have a web api which returns an image. I am trying to integrate this to my FO template.

<fo:block font-weight="normal" text-align="left">
     <fo:external-graphic src="url({$URL})">
     </fo:external-graphic>
</fo:block>

where $URL is "http://{servername}/images/{id}".

I am getting the following error:

HTTP Status 500 – Internal Server Error Type Exception Report

Message Servlet execution threw an exception

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) Root Cause

java.lang.NoClassDefFoundError: com/sun/media/jai/codec/FileCacheSeekableStream

I am able to access the image directly using http://{servername}/images/{id} url so the url is correct.

1
The important line is the last one: you are missing the JAI (Java Advanced Imaging) jar. You have to download it and put (or link) it in the lib folder. - lfurini
Thanks, just posted the root cause of the problem. - developer
From others question also unaswered it looks like there is a problem with JAI installation and JDK/JRE folders. - Alejandro

1 Answers

1
votes

The root cause was FOP was not able to load PNG image for PDF file. It worked fine with JPEG/BMP/GIF.

https://xmlgraphics.apache.org/fop/2.0/graphics.html