I am having the same problem as noted in the existing thread below.
Is there a way to update the shapefile with the REST API?  I am using
Geoserver 2.0.2 on Windows XP and it's installed to the default location.
When I try to do a PUT the second time, I get "error in opening zip file".
I tried renaming the .shp file and/or .zip file for the second PUT as
suggested but I still get the same error.  Any ideas?  The only way I can
get this to "work" is if I manually delete my folder from GeoServer
2.0.2\data_dir\data.

Thanks,
Ashley

 

============================================================================
===================

Hi Jose,



Thanks for supplying all the information for this. I spent a couple of 

hours today looking at this and I don't have a great explanation. Here 

is what I found.



There is a bug in the code where the uploaded zip file can overwrite the 

original files. This will happen when the store name is equal to the 

file name. And in this case it is. One thing to try would be to try it 

with the file names different. For instance, create a store named 

"buildings" but rename the shapefile to buildings_foo.shp or something. 

See if that works.



As for being able to replicate the issue I could not with any 

repeatability. My current guess is that there is some file locking going 

on. Ie a datastore is holding onto the shapefiles you are trying to 

overwrite. Again I was not able to affirm this was any repeatability. We 

could have the code dispose the existing datastore manually before 

updating. This should ensure nothing else is holding onto the files when 

overwriting them.



However can you try the renaming thing first since that one is much 

easier to fix.



Thanks.



-Justin



On 1/20/10 11:09 AM, jose garcia wrote:

> Hi Justin

>

> GeoServer it's installed in C:\programs\geoserver-2.0.0 and the

> shapefiles are stored in C:\programs\geoserver-2.0.0\data_dir\data

>

> I tried to delete the files manually with the Windows Explorer and

> there's no problem, so seem not blocked. Seem more that GeoServer have

> problems when unziping the file, if the files already exists in the
folder.

>

> Thanks and regards,

> Jose Garcia

>

> On Wed, Jan 20, 2010 at 4:22 PM, Justin Deoliveira <[email protected]

> < <mailto:[email protected]> mailto:[email protected]>> wrote:

>

>     Hi Jose,

>

>     Sorry for the reply. I know this functionality works on "regular"

>     setup so I assume it is something specific to the vista setup.

>

>     I recently acquired a vista virtual machine so I can try this out.

>     To do so can you tell me about the setup. Where is gs installed? And

>     where does the data directory reside. Thanks.

>

>     -Justin

>

>     jose garcia wrote:

>

>         HI

>

>         I'm trying to upload a shapefile with REST API several times (to

>         update the data of the feature type):

>

>         curl -u admin:geoserver -XPUT -H 'Content-type: application/zip'

>         --data-binary @buildings.zip

>         

>
<http://localhost:8080/geoserver/rest/workspaces/acme/datastores/buildings/f
ile.shp>
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/buildings/fi
le.shp

>

>         The first time works ok, but next time I get  this exception:

>

>         19 ene 13:10:38 ERROR [geoserver.rest] -

>         org.geoserver.rest.RestletException: java.util.zip.ZipException:

>         error in openin

>         g zip file

>                 at

>
org.geoserver.catalog.rest.StoreFileResource.handleFileUpload(StoreFi

>         leResource.java:99)

>                 at

>
org.geoserver.catalog.rest.DataStoreFileResource.handlePut(DataStoreF

>         ileResource.java:112)

>                 at org.restlet.Finder.handle(Finder.java:298)

>                 at

>
org.geoserver.rest.BeanDelegatingRestlet.handle(BeanDelegatingRestlet

>         .java:38)

>                 at org.restlet.Filter.doHandle(Filter.java:105)

>                 at org.restlet.Filter.handle(Filter.java:134)

>                 at org.restlet.Router.handle(Router.java:444)

>

>

>         I tried to delete the datastore, removing first the layer and

>         the featuretype so later trying to upload the shapefile again.

>         In this case sometimes it's working but others getting the

>         before error.

>

>         The problem seem that in the data directory the shapefile files

>         are not deleted after the featuretype or datastore are deleted.

>         If the files are deleted manually from the directory then works
ok.

>

>         Not sure if I'm doing something wrong or it's a bug of the REST
API.

>

>         I'm using Windows Vista and Geoserver it's not installed in

>         Program Files folder.

>

>         Regards,

>         Jose Garcia

>

>

>         

> ------------------------------------------------------------------------

>

>         

>
----------------------------------------------------------------------------
--

>         Throughout its 18-year history, RSA Conference consistently

>         attracts the

>         world's best and brightest in the field, creating opportunities

>         for Conference

>         attendees to learn about information security's most important

>         issues through

>         interactions with peers, luminaries and emerging and established

>         companies.

>          <http://p.sf.net/sfu/rsaconf-dev2dev>
http://p.sf.net/sfu/rsaconf-dev2dev

>

>

>         

> ------------------------------------------------------------------------

>

>         _______________________________________________

>         Geoserver-devel mailing list

>         [email protected]

>         < <mailto:[email protected]>
mailto:[email protected]>

>          <https://lists.sourceforge.net/lists/listinfo/geoserver-devel>
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

>

>

>     --

>     Justin Deoliveira

>     OpenGeo -  <http://opengeo.org/> http://opengeo.org

>     Enterprise support for open source geospatial.


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to