[Geoserver-users] Custom javascript function in SLD causes java.lang.NoSuchMethodException: No such method: run

With a simple javascript function (myFn.js) like this:

function run(value, args){

return 20;

}

Used in an SLD like this:

<?xml version="1.0" encoding="UTF-8"?>

<sld:UserStyle xmlns=“http://www.opengis.net/sld

xmlns:sld=“http://www.opengis.net/sld

xmlns:ogc=“http://www.opengis.net/ogc

xmlns:gml=“http://www.opengis.net/gml”>

sld:NameDefault Styler</sld:Name>

sld:FeatureTypeStyle

sld:Namename</sld:Name>

sld:Rule

sld:PointSymbolizer

sld:Graphic

sld:ExternalGraphic

<sld:OnlineResource xmlns:xlink=“http://www.w3.org/1999/xlink” xlink:type=“simple”

xlink:href=“http://localhost:82/geoserver/styles/mapIcons/Recovery.svg”/>

sld:Formatimage/svg+xml</sld:Format>

</sld:ExternalGraphic>

sld:Size

<ogc:Function name=“myFn”></ogc:Function>

</sld:Size>

</sld:Graphic>

</sld:PointSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

Geoserver always throws an exception when invoking the function from the SLD:

Caused by: java.lang.NoSuchMethodException: No such method: run

Hey Tim,

I have actually hit this as well. Unfortunately there seems to be a bug in the javascript module at this point. I can confirm that the python module functions correctly though.

-Justin

···

On Sat, Feb 8, 2014 at 12:31 PM, Keane, Tim <tkeane@anonymised.com> wrote:

With a simple javascript function (myFn.js) like this:

function run(value, args){

return 20;

}

Used in an SLD like this:

<?xml version="1.0" encoding="UTF-8"?>

<sld:UserStyle xmlns=“http://www.opengis.net/sld

xmlns:sld=“http://www.opengis.net/sld

xmlns:ogc=“http://www.opengis.net/ogc

xmlns:gml=“http://www.opengis.net/gml”>

sld:NameDefault Styler</sld:Name>

sld:FeatureTypeStyle

sld:Namename</sld:Name>

sld:Rule

sld:PointSymbolizer

sld:Graphic

sld:ExternalGraphic

<sld:OnlineResource xmlns:xlink=“http://www.w3.org/1999/xlink” xlink:type=“simple”

xlink:href=“http://localhost:82/geoserver/styles/mapIcons/Recovery.svg”/>

sld:Formatimage/svg+xml</sld:Format>

</sld:ExternalGraphic>

sld:Size

<ogc:Function name=“myFn”></ogc:Function>

</sld:Size>

</sld:Graphic>

</sld:PointSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

Geoserver always throws an exception when invoking the function from the SLD:

Caused by: java.lang.NoSuchMethodException: No such method: run


Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk


Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Justin Deoliveira
Vice President, Engineering | Boundless
jdeolive@anonymised.com
@j_deolive