[Geoserver-users] Upload H2 database with REST API

Hi

I’m trying to upload a H2 database to an existing PostGIS datastore using the REST API.

$ curl -u admin:XXXXXX -v -XPUT -H “Content-type: h2” --data-binary @myfirstjaspadb.h2 http://localhost:8080/geoserver/rest/workspaces/postgis/datastores/postgis/file.h2

But the data is not loaded in postgis database and no layer is created in GeoServer. Tried also for Content-type: application/h2 , as documentation is no clear about the exact value to provide, but same result.

The output for curl seem fine:

  • Adding handle: conn: 0x1679810
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 0 (0x1679810) send_pipe: 1, recv_pipe: 0
  • About to connect() to localhost port 8080 (#0)
  • Trying ::1…
  • Connection refused
  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 8080 (#0)
  • Server auth using Basic with user ‘admin’

PUT /geoserver/rest/workspaces/postgis/datastores/postgis/file.h2 HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.30.0
Host: localhost:8080
Accept: /
Content-type: h2
Content-Length: 35313664
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 202 Accepted
< Date: Tue, 25 Jun 2013 09:02:33 GMT

  • Server Noelios-Restlet-Engine/1.0…8 is not blacklisted
    < Server: Noelios-Restlet-Engine/1.0…8
    < Transfer-Encoding: chunked
    <
  • Connection #0 to host localhost left intact

and no error in GeoServer log, except this DEBUG message:

DEBUG [ows.OWSHandlerMapping] - No handler mapping found for [/rest/workspaces/postgis/datastores/postgis/file.h2]

Anyone knows what can cause this problem? Is there something wrong in the invocation of the REST service? When uploading a shapefile instead works fine.

Thanks and regards,
Jose García

Hi Jose,

There looks to be a big in the h2 file upload. The way the upload works is it relies on the zip file containing a file that matches the extension, in this case h2. But an h2 database has no file with such an extension. I tried a hack of changing the .data.db file to .h2 but it didn’t work either.

Feel free to open a jira for this.

-Justin

···

On Tue, Jun 25, 2013 at 5:20 AM, jose garcia <josegar74@anonymised.com> wrote:

Hi

I’m trying to upload a H2 database to an existing PostGIS datastore using the REST API.

$ curl -u admin:XXXXXX -v -XPUT -H “Content-type: h2” --data-binary @myfirstjaspadb.h2 http://localhost:8080/geoserver/rest/workspaces/postgis/datastores/postgis/file.h2

But the data is not loaded in postgis database and no layer is created in GeoServer. Tried also for Content-type: application/h2 , as documentation is no clear about the exact value to provide, but same result.

The output for curl seem fine:

  • Adding handle: conn: 0x1679810
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 0 (0x1679810) send_pipe: 1, recv_pipe: 0
  • About to connect() to localhost port 8080 (#0)
  • Trying ::1…
  • Connection refused
  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 8080 (#0)
  • Server auth using Basic with user ‘admin’

PUT /geoserver/rest/workspaces/postgis/datastores/postgis/file.h2 HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.30.0
Host: localhost:8080
Accept: /
Content-type: h2
Content-Length: 35313664
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 202 Accepted
< Date: Tue, 25 Jun 2013 09:02:33 GMT

  • Server Noelios-Restlet-Engine/1.0…8 is not blacklisted
    < Server: Noelios-Restlet-Engine/1.0…8
    < Transfer-Encoding: chunked
    <
  • Connection #0 to host localhost left intact

and no error in GeoServer log, except this DEBUG message:

DEBUG [ows.OWSHandlerMapping] - No handler mapping found for [/rest/workspaces/postgis/datastores/postgis/file.h2]

Anyone knows what can cause this problem? Is there something wrong in the invocation of the REST service? When uploading a shapefile instead works fine.

Thanks and regards,
Jose García


This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev


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


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

Hi Justin

Thanks for the feedback, I created this issue: https://jira.codehaus.org/browse/GEOS-5869

Regards,
Jose García

···

On Thu, Jun 27, 2013 at 2:44 PM, Justin Deoliveira <jdeolive@anonymised.com> wrote:

Hi Jose,

There looks to be a big in the h2 file upload. The way the upload works is it relies on the zip file containing a file that matches the extension, in this case h2. But an h2 database has no file with such an extension. I tried a hack of changing the .data.db file to .h2 but it didn’t work either.

Feel free to open a jira for this.

-Justin

On Tue, Jun 25, 2013 at 5:20 AM, jose garcia <josegar74@anonymised.com> wrote:

Hi

I’m trying to upload a H2 database to an existing PostGIS datastore using the REST API.

$ curl -u admin:XXXXXX -v -XPUT -H “Content-type: h2” --data-binary @myfirstjaspadb.h2 http://localhost:8080/geoserver/rest/workspaces/postgis/datastores/postgis/file.h2

But the data is not loaded in postgis database and no layer is created in GeoServer. Tried also for Content-type: application/h2 , as documentation is no clear about the exact value to provide, but same result.

The output for curl seem fine:

  • Adding handle: conn: 0x1679810
  • Adding handle: send: 0
  • Adding handle: recv: 0
  • Curl_addHandleToPipeline: length: 1
    • Conn 0 (0x1679810) send_pipe: 1, recv_pipe: 0
  • About to connect() to localhost port 8080 (#0)
  • Trying ::1…
  • Connection refused
  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 8080 (#0)
  • Server auth using Basic with user ‘admin’

PUT /geoserver/rest/workspaces/postgis/datastores/postgis/file.h2 HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.30.0
Host: localhost:8080
Accept: /
Content-type: h2
Content-Length: 35313664
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 202 Accepted
< Date: Tue, 25 Jun 2013 09:02:33 GMT

  • Server Noelios-Restlet-Engine/1.0…8 is not blacklisted
    < Server: Noelios-Restlet-Engine/1.0…8
    < Transfer-Encoding: chunked
    <
  • Connection #0 to host localhost left intact

and no error in GeoServer log, except this DEBUG message:

DEBUG [ows.OWSHandlerMapping] - No handler mapping found for [/rest/workspaces/postgis/datastores/postgis/file.h2]

Anyone knows what can cause this problem? Is there something wrong in the invocation of the REST service? When uploading a shapefile instead works fine.

Thanks and regards,
Jose García


This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev


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


Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.