While using GeoServer 2.6.2 for a project, I ran into an issue registering a styled layer descriptor (SLD) over the REST interface.
The SLD in question uses a PointSymbolizer, referring to a graphic in the same directory as the SLD. When I login to GeoServer’s administrative interface, I can easily create the SLD from scratch, and everything validates/saves/displays as expected. Original SLD.
The convenient geoserver-manager library for Java was working very well, including the functionality to register a new Shapefile, but programmatically uploading a legal SLD continued to result in the following errors:
- JBWEB000071: root cause
java.lang.Error: Failed to encode the xlink location
- JBWEB000071: root cause
java.net.MalformedURLException: no protocol: Food_Icon.png
To resolve the issue, add “file:” in the xlink location in the SLD: xlink:href=”file:Food_Icon.png”. The SLD should now be able to be uploaded to GeoServer over the REST interface.