Bug 53560 - 1.1rc1: SVG + Servlet problem. The file format is not supported. No ImagePreloader found.
Summary: 1.1rc1: SVG + Servlet problem. The file format is not supported. No ImagePrel...
Status: RESOLVED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: trunk
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-17 20:03 UTC by f.bosch
Modified: 2012-08-11 22:19 UTC (History)
0 users



Attachments
console output (4.34 KB, text/plain)
2012-07-18 08:25 UTC, f.bosch
Details
the servlet (11.16 KB, text/x-java)
2012-07-18 08:33 UTC, f.bosch
Details
Attachment includes minimal test for embedding SVG, result.pdf and console output (11.05 KB, application/zip)
2012-08-07 09:38 UTC, f.bosch
Details
the servlet (10.49 KB, text/x-java)
2012-08-11 11:29 UTC, f.bosch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description f.bosch 2012-07-17 20:03:43 UTC
System:
- debian squeeze
- openjdk
- tomcat6
- fop 1.1 rc1
- attached the servlet

First, build fop 1.0 from source with ant and deployed fop.war to tomcat6. Had problems, see https://bugs.launchpad.net/ubuntu/+source/fop/+bug/268930. Copying xml-apis-ext.jar to /var/lib/tomcat6/webapps/fop/WEB-INF/lib/ fixed the problem.

Then, upgrading to fop 1.1rc1, also built from source, keeps saying:  Image not available. URI: [file]. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported.  No ImagePreloader found for [file]

I feel that this is a build or dependency problem, because all libraries are in place.
Comment 1 Glenn Adams 2012-07-17 20:40:04 UTC
The first question you should ask yourself is "did I provide all the essential information to understand this bug?" Unfortunately, you fail to provide any information on what kind of image file format is a problem, you fail to provide an input FO test file, you fail to provide a console output. In other words, you failed to create a meaningful bug report. I should just mark this bug as INVALID, but instead I'll mark it as NEEDINFO.

Please read [1] before you proceed further.

[1] http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
Comment 2 Chris Bowditch 2012-07-18 07:50:23 UTC
Did you put imageio tools JAR in the class path? Some image formats require this library in order for FOP to process them. That's justa guess at the issue though and we really need the information requested by Glenn.
Comment 3 f.bosch 2012-07-18 08:25:44 UTC
Created attachment 29074 [details]
console output
Comment 4 f.bosch 2012-07-18 08:31:50 UTC
Sorry for bad communication. I understand I left out essential information. It is SVG images that are not working. Please find attached console output. Because my FO input file contains client information I need to generate a FO test file which I will upload today.

As said, I feel that this is a build or dependency problem. When I run the FO file through the command line, as shown below, the pdf does contain images.

fop-1.1rc1 $ ./fop -c ~/foconfig.xml ~/foinput.fo ~/fooutput.pdf
Comment 5 f.bosch 2012-07-18 08:33:54 UTC
Created attachment 29075 [details]
the servlet
Comment 6 f.bosch 2012-08-07 09:38:54 UTC
Created attachment 29177 [details]
Attachment includes minimal test for embedding SVG, result.pdf and console output
Comment 7 f.bosch 2012-08-07 09:41:48 UTC
I only receive the error for SVG files. Other images are working OK. On the same Tomcat6 server I have FOP 1.0 running without any problems.
Comment 8 f.bosch 2012-08-07 15:35:45 UTC
The problem does not occur when using command line interface.
Comment 9 Luis Bernardo 2012-08-10 14:53:43 UTC
I tested with jetty and it works. There are just a few tweaks that are needed. First, I used the default servlet that comes with FOP (used 1.1 rc1 too). Edit the servlet task in the build.xml to add the xml-apis*jar files (as you noticed they seem to be necessary). Then ant servlet creates the fop.war in the build directory. Copy that to the webapps folder of jetty, then java -jar start.jar.

The input.fo file had to be changed so that the test.svg file is referenced by the full path (otherwise you need to tell the servlet to use a config file that specifies the base url).
Comment 10 f.bosch 2012-08-11 11:28:02 UTC
After editing the build.xml and adding the line <include name="xml-apis*jar" /> it did work. I don't know why it did not work when added the .jar to the fop webapp directory. Maybe (probably) because I made a mistake.

Anyway, it would be great if the line would added to build.xml as default. I'd love to create a patch, but never done that before.

Furthermore, I would also suggest to use my servlet (will attach new file) as default FopServlet, because it enables to attach a config to your request. I am also working on error handling in the servlet because I believe you should be able to debug your FO/XSL/XML files when the process fails.
Comment 11 f.bosch 2012-08-11 11:29:14 UTC
Created attachment 29211 [details]
the servlet
Comment 12 Luis Bernardo 2012-08-11 22:19:55 UTC
with jetty, the *.war file placed in the webapps is deployed to a new directory when jetty starts; jar files in the webapps directory are not deployed, and they are not picked up either if they are added to the deployment directory after jetty starts. tomcat probably does something similar...

if you would like your servlet to be considered for integration in the trunk you need to submit a patch. if you used eclipse to get the source you can easily create one with Team -> Create Patch. you should also then edit the title and add [PATCH] to it.