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
java.lang.NullPointerException
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
EDIT
sample data