iText BaseFont.getCharBBox method not found when depending on iText 2.1.7

5,741 views
Skip to first unread message

John M.

unread,
Sep 4, 2013, 8:14:00 AM9/4/13
to flying-sa...@googlegroups.com
I'm using Flying Saucer through Grails Rendering plugin (":rendering:0.4.4"). I've included the following dependencies:

compile 'org.xhtmlrenderer:flying-saucer-core:9.0.2' 
compile 'org.xhtmlrenderer:flying-saucer-pdf:9.0.2'
runtime 'com.lowagie:itext:2.1.7'

I chose the 2.1.7 iText because that is the one referred to here (and previous pom.xml versions I thought belonged to 9.0.2):
https://github.com/flyingsaucerproject/flyingsaucer/blob/master/flying-saucer-pdf/pom.xml


Nevertheless, I'm getting a java.lang.NoSuchMethodError on com.lowagie.text.pdf.BaseFont.getCharBBox(C)[I when rending my (very simple) report to PDF.

Any ideas what I'm doing wrong from dependency management or some other perspective?

Regards,
John

P.S. Exception attached, not sure it is that interesting:


Caused by: java.lang.NoSuchMethodError: com.lowagie.text.pdf.BaseFont.getCharBBox(C)[I
at org.xhtmlrenderer.pdf.ITextFontResolver$FontDescription.setMetricDefaults(ITextFontResolver.java:679)
at org.xhtmlrenderer.pdf.ITextFontResolver$FontDescription.<init>(ITextFontResolver.java:610)
at org.xhtmlrenderer.pdf.ITextFontResolver.addCourier(ITextFontResolver.java:410)
at org.xhtmlrenderer.pdf.ITextFontResolver.createInitialFontMap(ITextFontResolver.java:390)
at org.xhtmlrenderer.pdf.ITextFontResolver.<init>(ITextFontResolver.java:52)
at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:115)
at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:102)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:991)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at grails.plugin.rendering.pdf.PdfRenderingService.doRender(PdfRenderingService.groovy:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1265)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:272)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:43)
at grails.plugin.rendering.RenderingService$render$1.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:37)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:35)
at grails.plugin.rendering.RenderingService$render$0.callCurrent(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:65)
at grails.plugin.rendering.RenderingService$render.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)


Peter Brant

unread,
Sep 4, 2013, 9:10:40 AM9/4/13
to flying-sa...@googlegroups.com
The plugin (or something else) must be pulling in an old version of Flying Saucer.  Note that FS wasn't officially released on Maven until version 9.  Various 3rd parties had released various versions with various group and artifact names.  You'll have to manually exclude whatever is being pulled in.

I did double-check that the released version of 9.0.2 uses the proper signature for iText 2.1.x (see below).

Pete

private void setMetricDefaults();
  Signature: ()V
  Code:
   0: aload_0
   1: ldc #12; //float -50.0f
   3: putfield #8; //Field _underlinePosition:F
   6: aload_0
   7: ldc #13; //float 50.0f
   9: putfield #9; //Field _underlineThickness:F
   12: aload_0
   13: getfield #4; //Field _font:Lcom/lowagie/text/pdf/BaseFont;
   16: bipush 120
   18: invokevirtual #14; //Method com/lowagie/text/pdf/BaseFont.getCharBBox:(I)[I



--
You received this message because you are subscribed to the Google Groups "Flying Saucer Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flying-saucer-u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

John M.

unread,
Sep 7, 2013, 5:54:57 AM9/7/13
to flying-sa...@googlegroups.com
Apologies, you are absolutely correct.

An old version of the library (core-renderer-R8.jar) is included with Grails itself and while I haven't figured out a good solution to that yet, it is certainly not a FS problem.

Thanks for your help.

Regards,
John

Athlan

unread,
Nov 12, 2013, 5:12:24 AM11/12/13
to flying-sa...@googlegroups.com
John, thanks for hint. Which libraries (repo/name) in which versions (it is important) I need to include to run code without the error?
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages