[Geoserver-users] geoserver 2.7 publish style

I’m trying to publish a style to geoserver 2.7 via the GeoServerRESTPublisher class.

If I use the publishStyle(File file) API or the publishStyle(String sldBody) I get the following error

17:19:55,192 ERROR [stderr] (http-/0.0.0.0:8080-1) [Fatal Error] :1:1: Content is not allowed in prolog.

17:19:55,193 ERROR [org.geoserver.rest] (http-/0.0.0.0:8080-1) : java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:438) [gt-main-13.1.jar:]

at org.geoserver.catalog.SLDHandler.parse10(SLDHandler.java:105) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.SLDHandler.parse(SLDHandler.java:97) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.rest.StyleFormat.read(StyleFormat.java:91) [gs-restconfig-2.7.1.jar:2.7.1]

at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:34) [gs-rest-2.7.1.jar:2.7.1]

at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:118) [gs-rest-2.7.1.jar:2.7.1]

The style xml is below. I formatted it in this email but usually its one long string. I’ve tried trimming for whitespace, removing the encoding, and some other validation checks I’ve found online. I was wondering if anything stands out.

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

<sld:StyledLayerDescriptor 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” version=“1.0.0”>

sld:NamedLayer

sld:Namenrdb_threshold_132</sld:Name>

sld:UserStyle

sld:Namesurface air temperature</sld:Name>

sld:FeatureTypeStyle

sld:Namenrdb_threshold_132</sld:Name>

sld:FeatureTypeNameFeature</sld:FeatureTypeName>

sld:Rule

sld:RasterSymbolizer

<sld:ColorMap type=“intervals”>

<sld:ColorMapEntry color=“#FFFF00” opacity=“0.0” quantity=“244.16111108888893” label=“244.16111108888893”/>

<sld:ColorMapEntry color=“#008000” opacity=“1.0” quantity=“283.789” label=“283.789”/>

</sld:ColorMap>

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>

Can you try your style in the style editor and confirm it validates?

···

On 5 June 2015 at 10:31, Bessette-Halsema, Dominique E <Dominique.Bessette@anonymised.com> wrote:

I’m trying to publish a style to geoserver 2.7 via the GeoServerRESTPublisher class.

If I use the publishStyle(File file) API or the publishStyle(String sldBody) I get the following error

17:19:55,192 ERROR [stderr] (http-/0.0.0.0:8080-1) [Fatal Error] :1:1: Content is not allowed in prolog.

17:19:55,193 ERROR [org.geoserver.rest] (http-/0.0.0.0:8080-1) : java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:438) [gt-main-13.1.jar:]

at org.geoserver.catalog.SLDHandler.parse10(SLDHandler.java:105) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.SLDHandler.parse(SLDHandler.java:97) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.rest.StyleFormat.read(StyleFormat.java:91) [gs-restconfig-2.7.1.jar:2.7.1]

at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:34) [gs-rest-2.7.1.jar:2.7.1]

at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:118) [gs-rest-2.7.1.jar:2.7.1]

The style xml is below. I formatted it in this email but usually its one long string. I’ve tried trimming for whitespace, removing the encoding, and some other validation checks I’ve found online. I was wondering if anything stands out.

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

<sld:StyledLayerDescriptor 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” version=“1.0.0”>

sld:NamedLayer

sld:Namenrdb_threshold_132</sld:Name>

sld:UserStyle

sld:Namesurface air temperature</sld:Name>

sld:FeatureTypeStyle

sld:Namenrdb_threshold_132</sld:Name>

sld:FeatureTypeNameFeature</sld:FeatureTypeName>

sld:Rule

sld:RasterSymbolizer

<sld:ColorMap type=“intervals”>

<sld:ColorMapEntry color=“#FFFF00” opacity=“0.0” quantity=“244.16111108888893” label=“244.16111108888893”/>

<sld:ColorMapEntry color=“#008000” opacity=“1.0” quantity=“283.789” label=“283.789”/>

</sld:ColorMap>

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>



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


Jody Garnett

I did and it does. I can validate and submit it through the geoserver console.

Dominique Bessette

Software Engineer

General Dynamics Information Technology

Office: 619-881-2748

···

Can you try your style in the style editor and confirm it validates?

Jody Garnett

On 5 June 2015 at 10:31, Bessette-Halsema, Dominique E <Dominique.Bessette@…1196…> wrote:

I’m trying to publish a style to geoserver 2.7 via the GeoServerRESTPublisher class.

If I use the publishStyle(File file) API or the publishStyle(String sldBody) I get the following error

17:19:55,192 ERROR [stderr] (http-/0.0.0.0:8080-1) [Fatal Error] :1:1: Content is not allowed in prolog.

17:19:55,193 ERROR [org.geoserver.rest] (http-/0.0.0.0:8080-1) : java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:438) [gt-main-13.1.jar:]

at org.geoserver.catalog.SLDHandler.parse10(SLDHandler.java:105) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.SLDHandler.parse(SLDHandler.java:97) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.rest.StyleFormat.read(StyleFormat.java:91) [gs-restconfig-2.7.1.jar:2.7.1]

at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:34) [gs-rest-2.7.1.jar:2.7.1]

at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:118) [gs-rest-2.7.1.jar:2.7.1]

The style xml is below. I formatted it in this email but usually its one long string. I’ve tried trimming for whitespace, removing the encoding, and some other validation checks I’ve found online. I was wondering if anything stands out.

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

<sld:StyledLayerDescriptor 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” version=“1.0.0”>

sld:NamedLayer

sld:Namenrdb_threshold_132</sld:Name>

sld:UserStyle

sld:Namesurface air temperature</sld:Name>

sld:FeatureTypeStyle

sld:Namenrdb_threshold_132</sld:Name>

sld:FeatureTypeNameFeature</sld:FeatureTypeName>

sld:Rule

sld:RasterSymbolizer

<sld:ColorMap type=“intervals”>

<sld:ColorMapEntry color=“#FFFF00” opacity=“0.0” quantity=“244.16111108888893” label=“244.16111108888893”/>

<sld:ColorMapEntry color=“#008000” opacity=“1.0” quantity=“283.789” label=“283.789”/>

</sld:ColorMap>

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

HI Dominique,
do you have by any chance request logging enabled in web.xml (it is not by default, just checking if you did enabled it)?
If so, does your request work if you turn it off?

Cheers
Andrea

···

On Fri, Jun 5, 2015 at 7:31 PM, Bessette-Halsema, Dominique E <Dominique.Bessette@anonymised.com> wrote:

I’m trying to publish a style to geoserver 2.7 via the GeoServerRESTPublisher class.

If I use the publishStyle(File file) API or the publishStyle(String sldBody) I get the following error

17:19:55,192 ERROR [stderr] (http-/0.0.0.0:8080-1) [Fatal Error] :1:1: Content is not allowed in prolog.

17:19:55,193 ERROR [org.geoserver.rest] (http-/0.0.0.0:8080-1) : java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:438) [gt-main-13.1.jar:]

at org.geoserver.catalog.SLDHandler.parse10(SLDHandler.java:105) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.SLDHandler.parse(SLDHandler.java:97) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.rest.StyleFormat.read(StyleFormat.java:91) [gs-restconfig-2.7.1.jar:2.7.1]

at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:34) [gs-rest-2.7.1.jar:2.7.1]

at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:118) [gs-rest-2.7.1.jar:2.7.1]

The style xml is below. I formatted it in this email but usually its one long string. I’ve tried trimming for whitespace, removing the encoding, and some other validation checks I’ve found online. I was wondering if anything stands out.

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

<sld:StyledLayerDescriptor 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” version=“1.0.0”>

sld:NamedLayer

sld:Namenrdb_threshold_132</sld:Name>

sld:UserStyle

sld:Namesurface air temperature</sld:Name>

sld:FeatureTypeStyle

sld:Namenrdb_threshold_132</sld:Name>

sld:FeatureTypeNameFeature</sld:FeatureTypeName>

sld:Rule

sld:RasterSymbolizer

<sld:ColorMap type=“intervals”>

<sld:ColorMapEntry color=“#FFFF00” opacity=“0.0” quantity=“244.16111108888893” label=“244.16111108888893”/>

<sld:ColorMapEntry color=“#008000” opacity=“1.0” quantity=“283.789” label=“283.789”/>

</sld:ColorMap>

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>



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

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


I believe it is set to false.

Request Logging Filter

org.geoserver.filters.LoggingFilter

enabled

false

log-request-bodies

false

Dominique Bessette

Software Engineer

General Dynamics Information Technology

Office: 619-881-2748

···

HI Dominique,

do you have by any chance request logging enabled in web.xml (it is not by default, just checking if you did enabled it)?

If so, does your request work if you turn it off?

Cheers

Andrea

On Fri, Jun 5, 2015 at 7:31 PM, Bessette-Halsema, Dominique E <Dominique.Bessette@…1196…> wrote:

I’m trying to publish a style to geoserver 2.7 via the GeoServerRESTPublisher class.

If I use the publishStyle(File file) API or the publishStyle(String sldBody) I get the following error

17:19:55,192 ERROR [stderr] (http-/0.0.0.0:8080-1) [Fatal Error] :1:1: Content is not allowed in prolog.

17:19:55,193 ERROR [org.geoserver.rest] (http-/0.0.0.0:8080-1) : java.lang.RuntimeException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.

at org.geotools.styling.SLDParser.parseSLD(SLDParser.java:438) [gt-main-13.1.jar:]

at org.geoserver.catalog.SLDHandler.parse10(SLDHandler.java:105) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.SLDHandler.parse(SLDHandler.java:97) [gs-main-2.7.1-nn-1.jar:2.7.1-nn-1]

at org.geoserver.catalog.rest.StyleFormat.read(StyleFormat.java:91) [gs-restconfig-2.7.1.jar:2.7.1]

at org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.java:34) [gs-rest-2.7.1.jar:2.7.1]

at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:118) [gs-rest-2.7.1.jar:2.7.1]

The style xml is below. I formatted it in this email but usually its one long string. I’ve tried trimming for whitespace, removing the encoding, and some other validation checks I’ve found online. I was wondering if anything stands out.

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

<sld:StyledLayerDescriptor 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” version=“1.0.0”>

sld:NamedLayer

sld:Namenrdb_threshold_132</sld:Name>

sld:UserStyle

sld:Namesurface air temperature</sld:Name>

sld:FeatureTypeStyle

sld:Namenrdb_threshold_132</sld:Name>

sld:FeatureTypeNameFeature</sld:FeatureTypeName>

sld:Rule

sld:RasterSymbolizer

<sld:ColorMap type=“intervals”>

<sld:ColorMapEntry color=“#FFFF00” opacity=“0.0” quantity=“244.16111108888893” label=“244.16111108888893”/>

<sld:ColorMapEntry color=“#008000” opacity=“1.0” quantity=“283.789” label=“283.789”/>

</sld:ColorMap>

</sld:RasterSymbolizer>

</sld:Rule>

</sld:FeatureTypeStyle>

</sld:UserStyle>

</sld:NamedLayer>

</sld:StyledLayerDescriptor>



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.