2015-02-06 67 views
0

我在使用Spring時遇到問題。使用FOP的Spring MVC無法轉換爲org.apache.fop.render.AbstractRendererMaker

我已經使用Spring和FOP來創建PDF文件。但我有一個發出:當我創建的FopFactory

 FileInputStream input = new FileInputStream(file); 
     ByteArrayOutputStream out = new ByteArrayOutputStream(); 
     FopFactory ff = FopFactory.newInstance(); 

     FOUserAgent fua = ff.newFOUserAgent(); 

新實例,這是一個pom.xml的

<dependency> 
     <groupId>org.apache.xmlgraphics</groupId> 
     <artifactId>fop</artifactId> 
     <version>1.1</version> 
    </dependency> 

請幫我檢查一下

java.lang.ClassCastException: org.apache.fop.render.pdf.PDFRendererMaker cannot be cast to org.apache.fop.render.AbstractRendererMaker 
at org.apache.fop.render.RendererFactory.discoverRenderers(RendererFactory.java:425) 
at org.apache.fop.render.RendererFactory.<init>(RendererFactory.java:61) 
at org.apache.fop.apps.FopFactory.<init>(FopFactory.java:179) 
at org.apache.fop.apps.FopFactory.newInstance(FopFactory.java:190) 

這個錯誤出現!

謝謝!

+0

我也得到相同的異常。只是想知道你有沒有得到任何解決方案? – Abhijit 2015-09-25 21:12:19

+0

@Ahhijit,我已經回答了這個問題xD – 2015-09-27 03:58:09

回答

0

對不起,我已經改變了版本FOP的這種運行成功

<dependency> 
     <groupId>org.apache.xmlgraphics</groupId> 
     <artifactId>fop</artifactId> 
     <version>1.0</version> 
    </dependency> 

@Abhijit您可以檢查此:d

相關問題