[Geoserver-users] REST NPE while uploading features to Geoserver

Justin,

Even with leaving this off I get a NullPointerException on upload.

Is the problem the fact that I don't have a .prj file?

Would that solve the NullPointerException?

Nothing else looks obvious...

Btw, does Geoserver version 1.7.6 contain any fixes for this?

Thanks,

Ronak Patel

-----Original Message-----
From: Justin Deoliveira [mailto:jdeolive@anonymised.com]
Sent: Wednesday, August 12, 2009 1:13 PM
To: Patel, Ronak Avinash (US SSA)
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] REST NPE while uploading features to
Geoserver

Just leave it off. It is really on used to provide clients with a link
to any feature tyeps contained by the datastore. It really only makes
sense when doing a GET, so the client can traverse the links to the
contained feature types.

Patel, Ronak Avinash (US SSA) wrote:

Justin,

What should I be entering in the featureTypes element? Should I be
entering anything?? What does the featureTypes element used for? What
"type" is it?

Ronak Patel

-----Original Message-----
From: Justin Deoliveira [mailto:jdeolive@anonymised.com]
Sent: Wednesday, August 12, 2009 7:46 AM
To: Patel, Ronak Avinash (US SSA)
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] REST NPE while uploading features to
Geoserver

Yeah... that json looks a bit wierd.

"featureTypes": "shp"

Not sure what you mean there.

And for the workspace, i would avoid the nulls and just reference by
name. Actually you don't really need to specify it since it is

inferred

from the URL you are POSTing or PUTing to.

Or just include it by name:

"workspace":{"name":"hello"}

or even just:

"workspace": "hello"

should work.

-Justin

Patel, Ronak Avinash (US SSA) wrote:

Justin,

I am putting the following JSON:

POST /geoserver/rest/workspaces/hello/datastores HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
Content-Type: application/json
User-Agent: Java/1.6.0_13
Host: patel-xp.irad.net:9090
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 139

{"dataStore":{"enabled":"true","featureTypes":"shp","name":"testzip","wo

rkspace":{"coverageStores":null,"dataStores":null,"name":"hello"}}}

Are those nulls the problem?? Or the featureTypes parameter?

Ronak Patel

-----Original Message-----
From: Justin Deoliveira [mailto:jdeolive@anonymised.com]
Sent: Wednesday, August 05, 2009 4:53 PM
To: Patel, Ronak Avinash (US SSA)
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] REST NPE while uploading features to
Geoserver

Hi Ronak,

The error means that there is a problem with the xml you are

uploading.

Can you include the request and the xml you are trying to upload.

As for the zip file, it is the "regular" zip format (pkzip or

whichever)

, not gzip. The zip file you sent never got through to me. Is there
anyway you can post it? Or just send it to me direcetly, not cc'ing

the

public list.

-Justin

Patel, Ronak Avinash (US SSA) wrote:

Justin,

I tried setting the logging to GEOSERVER_DEVELOPER and it spit out

this

output to me:

05 Aug 13:37:33 DEBUG
[org.geoserver.security.RESTfulPathBasedFilterInvocationDe

finitionMap] - Candidate is: '/rest/workspaces/hello/datastores';
antPath is /**

; matchedPath=true; matchedMethods=true

05 Aug 13:37:33 ERROR [org.geoserver.rest] -

com.thoughtworks.xstream.converters.ConversionException:

featureTypes

:

featureT

ypes : featureTypes : featureTypes

*---- Debugging information ----*

*message : featureTypes : featureTypes*

*cause-exception :
com.thoughtworks.xstream.mapper.CannotResolveClassExceptio*

*n*

*cause-message : featureTypes : featureTypes*

*class : org.geoserver.catalog.impl.DataStoreInfoImpl*

*required-type : org.geoserver.catalog.impl.DataStoreInfoImpl*

*line number : -1*

*-------------------------------*

        at

com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshall

er.java:89)

        at

com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm

arshaller.java:76)

        at

com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnm

arshaller.java:60)

        at

com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller

.java:137)

        at

com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarsh

al(AbstractTreeMarshallingStrategy.java:33)

        at

com.thoughtworks.xstream.XStream.unmarshal(XStream.java:923)

        at

com.thoughtworks.xstream.XStream.unmarshal(XStream.java:909)

        at

com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)

        at

org.geoserver.config.util.XStreamPersister.load(XStreamPersister.java

:380)

        at

org.geoserver.catalog.rest.AbstractCatalogResource$2.read(AbstractCat

alogResource.java:72)

        at

org.geoserver.rest.format.StreamDataFormat.toObject(StreamDataFormat.

java:33)

        at

org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.j

ava:112)

        at org.restlet.Finder.handle(Finder.java:296)

        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)

        at

com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConve

rter.java:129)

        at

org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatche

r.java:79)

        at

org.springframework.web.servlet.mvc.AbstractController.handleRequest(

AbstractController.java:153)

        at

org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.ha

ndle(SimpleControllerHandlerAdapter.java:48)

        at

org.springframework.web.servlet.DispatcherServlet.doDispatch(Dispatch

erServlet.java:875)

        at

org.springframework.web.servlet.DispatcherServlet.doService(Dispatche

rServlet.java:809)

        at

org.springframework.web.servlet.FrameworkServlet.processRequest(Frame

workServlet.java:571)

        at

org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServ

Which class cannot be loaded???

Ronak

------------------------------------------------------------------------

*From:* Patel, Ronak Avinash (US SSA)
*Sent:* Wednesday, August 05, 2009 12:42 PM
*To:* Justin Deoliveira
*Cc:* geoserver-users@lists.sourceforge.net
*Subject:* Re: [Geoserver-users] REST NPE while uploading features

to

Geoserver

Justin,

Out of curiosity, does the ZIP file have to be a GZIP file? Or a

regular

zip file is good as well?

I can write out either using Java.

Please let me know what format I need....

Ronak

------------------------------------------------------------------------

*From:* Patel, Ronak Avinash (US SSA)
*Sent:* Tuesday, August 04, 2009 6:32 PM
*To:* Justin Deoliveira
*Cc:* geoserver-users@lists.sourceforge.net
*Subject:* REST NPE while uploading features to Geoserver

Hey Justin,

Thanks for the loads of help you've provided.

I had another question:

I'm trying to upload a shapefile (and its associated .shx and .dbf)
files as a zip file to geoserver using the REST configuration but I

seem

to get a NullPointerException back:

PUT

/geoserver/rest/workspaces/hello/datastores/testzip/file.shp?coverageNam

e=test

HTTP/1.1

Authorization: Basic YWRtaW46Z2Vvc2VydmVy

Content-Type: application/zip

User-Agent: Java/1.6.0_13

Host: patel-xp.irad.net:9090

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: keep-alive

Content-Length: 495

[The zip file containing the zip file]

The zip file I am sending is created by 7zip.

I get this error inside Geoserver:

04 Aug 18:29:56 ERROR [geoserver.rest] - Error occured unzipping
file:error in o

pening zip file

Ronak Patel

Senior Software Engineer

BAE Systems NS

San Diego, CA

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

------------------------------------------------------------------------
------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day
trial. Simplify your report design, integration and deployment - and
focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users