2

We are working with GeoServer 2.16 version, and we have installed the AWS S3 Bucket plugin, to load GeoTIFF from our public S3 bucket. We are working with GeoServer REST API to load a GeoTIFF from S3 on a specific workspace using POST request, this is the XML parsed:

<coverageStore>
     <name>test_dem</name>
     <workspace>Sentinel_1</workspace>
     <enabled>true</enabled>
     <type>S3GeoTiff</type>
     <url>s3://xxxxxxxxx/public/test/geoserver/xxxxxxxxx_cog.tif?useAnon=true&awsRegion=EU_CENTRAL_1</url>
</coverageStore>

and this is the endpoint of REST Request:

http://xxxxxxxxxxx:8080/geoserver/rest/workspaces/Sentinel_1/coveragestores?configure=all

This request gives us this error:

---- Debugging information ----
cause-exception     : com.thoughtworks.xstream.io.StreamException
cause-message       : 
class               : java.lang.String
required-type       : java.lang.String
converter-type      : com.thoughtworks.xstream.converters.SingleValueConverterWrapper
wrapped-converter   : com.thoughtworks.xstream.converters.basic.StringConverter
line number         : 6
class[1]            : org.geoserver.catalog.impl.CoverageStoreInfoImpl
required-type[1]    : org.geoserver.catalog.impl.CoverageStoreInfoImpl
converter-type[1]   : org.geoserver.config.util.XStreamPersister$StoreInfoConverter
version             : 2.16-SNAPSHOT
-------------------------------

And this is the GeoServer log:

Caused by: com.thoughtworks.xstream.io.StreamException: 
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:135)
at com.thoughtworks.xstream.io.xml.AbstractPullReader.getValue(AbstractPullReader.java:180)
at com.thoughtworks.xstream.converters.SingleValueConverterWrapper.unmarshal(SingleValueConverterWrapper.java:49)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
... 116 more
Caused by: org.xmlpull.v1.XmlPullParserException: entity reference name can not contain character =' 
(position: START_TAG seen ...c/test/geoserver/eu_dem_v11_E00N20_cog.tif?useAnon=true&awsRegion=... @6:106) 
at org.xmlpull.mxp1.MXParser.parseEntityRef(MXParser.java:2222)
at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1275)
at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
... 121 more

Any idea about this error? We have tried to load the same S3 path directly from GeoServer UI Interface and in this case, works. Any idea?

1 Answer 1

4

You are sending an XML file but it is not valid XML because your entity reference contains an invalid character.

Actually, you didn't want to use &awsRegion= as an entity but you forgot to XML escape the string before you sent it.

So your URL should be something like:

<url>s3://xxxxxxxxx/public/test/geoserver/xxxxxxxxx_cog.tif?useAnon=true&amp;awsRegion=EU_CENTRAL_1</url>

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.