I am generating the SVG file and then use it in jasper report print. When I try to render the map with no sld everything works great, but when I use sld there is this error:

2017-11-30T13:28:36.634+0100  SEVERE  null
    at org.apache.batik.svggen.ImageHandlerBase64Encoder.encodeImage(Unknown Source)
    at org.apache.batik.svggen.ImageHandlerBase64Encoder.handleHREF(Unknown Source)
    at org.apache.batik.svggen.DefaultImageHandler.handleImage(Unknown Source)
    at org.apache.batik.svggen.SimpleImageHandler.handleImage(Unknown Source)
    at org.apache.batik.svggen.SVGGraphics2D.drawRenderedImage(Unknown Source)
    at org.geotools.renderer.lite.StyledShapePainter.renderImage(StyledShapePainter.java:664)
    at org.geotools.renderer.lite.StyledShapePainter.paint(StyledShapePainter.java:226)
    at org.geotools.renderer.lite.StreamingRenderer$PaintShapeRequest.execute(StreamingRenderer.java:3245)
    at org.geotools.renderer.lite.StreamingRenderer$PainterThread.run(StreamingRenderer.java:3572)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)

To generate an SVG I am using https://github.com/geotools/geotools/blob/master/docs/src/main/java/org/geotools/render/GenerateSVG.java (same as here) with added transformation for correct orientation of the image. I use an sld with wkt strings and SVG files. For embedding generated SVG to jasper reports, I had to change the version of batik to 1.8 and to update SVGGraphicFactory to use that version. The problem occurs when generating svg, so I can't convert it to png for printing.

Version of geotools 17.1


sample data


  • can you add some sample data and the SLD you are using
    – Ian Turton
    Nov 30, 2017 at 13:13
  • added sample data Nov 30, 2017 at 22:13

1 Answer 1


This seems to be caused by a known bug in Batik (the SVG renderer that GeoTools uses). This seems to be a couple of years old and might be fixed in Batik 1.9.

  • the problem persists with batik maven even on 1.9, but I downloaded jars and it works now. The only problem is that it draws my symbols much smaller than they are. Dec 4, 2017 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.