zhihongzzh / flying-saucer

Automatically exported from code.google.com/p/flying-saucer
0 stars 0 forks source link

JAI libraries cause vendorName null #181

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a web project that uses JAI and includes the JAI jar files
2. Include XHTML Renderer
3. Get the exception seen below

ChannelImageInputStreamSpi could not be instantiated: 
java.lang.IllegalArgumentException: vendorName == null!
...
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
        at org.xhtmlrenderer.swing.Java2DTextRenderer.<init>(Java2DTextRenderer.java:66)

What is the expected output? What do you see instead?

My goal was to use Flying-Saucer but also keep existing image processing that 
existed in the application.  The image processing relied on the JAI libraries. 
The end result was that PDF library would only work if the JAI libraries were 
removed from the war.  

What version of the product are you using? On what operating system?

Version of product:
<dependency>
    <groupId>org.xhtmlrenderer</groupId>
    <artifactId>core-renderer</artifactId>
    <version>R8</version>
</dependency>

Development System: Mac OS X 10.6.8
Deployment Container: Glassfish 2.1.1

Please provide any additional information below.

I have found that this exception occurs when Implementation-Vendor and 
Specification-Vendor are not specified in the jar file.  My first assumption 
was that it was the jai libraries.  I checked, those libraries do include the 
vendor information.  

After doing some more research I decided to try to modify the MANIFEST.MF file 
for core-renderer-R8.  I changed the manifest to read as shown below.  Once I 
did that and deployed my war file to glassfish I was able to both generate PDF 
files and use the JAI image libraries to modify images.  My suggestion is to 
include Vendor information in the manifest file included in the jar that is 
deployed to the maven repository.

Flying-saucer appears to be working very well since I've made this change.

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.5.0_16-133 (Apple Inc.)
Implementation-Vendor: VendorNameHere
Specification-Vendor: VendorNameHere

Original issue reported on code.google.com by jrhagaky...@gmail.com on 17 Nov 2011 at 4:14