I am configuring a GeoServer 2.1.3 data store using Shapefiles through the
REST interface. The shapefiles and their extents can change and I need to be
able to recreate the data store if this happens.
The process looks like this:
- if layer group (which uses the data store) exists
- delete it
- if the incoming data store's workspace does not exist
- create it
- if the data store exists
- delete it
- create the data store using shapefiles
- assign styles to the feature types in this data store
- create a layer group from the data store's layers
After the process has run once it writes a 'flag' file to disk telling the
(java) application not to bother reconfiguring the data store the next time
around. When updated shapefiles are available this flag is deleted so that
the process runs again.
I am testing this by running the process once, then deleting the flag file,
then running it again. The process runs fine the first time, but on the
second run creating the data store errors with NullPointerException. A small
section of the stack trace looks like this:
10 Jul 10:41:37 INFO [catalog.rest] - Auto-configuring datastore:
CustomerMaps
10 Jul 10:41:49 ERROR [geoserver.ows] -
java.lang.NullPointerException
at
org.geoserver.catalog.impl.DefaultCatalogFacade.getResource(DefaultCatalogFacade.java:288)
at
org.geoserver.catalog.impl.CatalogImpl.getResource(CatalogImpl.java:413)
at
org.geoserver.catalog.impl.CatalogImpl.getFeatureType(CatalogImpl.java:507)
at
org.geoserver.catalog.ResourcePool$FeatureTypeCache.removeLRU(ResourcePool.java:1392)
at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:239)
at
org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:282)
at
org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:687)
at
org.geoserver.catalog.ResourcePool.getFeatureType(ResourcePool.java:599)
at
org.geoserver.catalog.impl.FeatureTypeInfoImpl.getFeatureType(FeatureTypeInfoImpl.java:86)
If I re-run the configuration to try and fix the problem I then get an error
when deleting the data store:
10 Jul 10:47:54 ERROR [geoserver.rest] - :Unable to delete non-empty store.
10 Jul 10:47:54 ERROR [geoserver.rest] -
org.geoserver.rest.RestletException: java.lang.IllegalArgumentException:
Unable to delete non-empty store.
at
org.geoserver.rest.ReflectiveResource.handleException(ReflectiveResource.java:325)
at
org.geoserver.rest.ReflectiveResource.handleDelete(ReflectiveResource.java:227)
Even though I am deleting the data store with the recurse=true parameter.
Please note this does not happen if I restart Tomcat between the first
(successful) configuration and the second reconfiguration. The error does
not seem related to whether the data store already exists or not, but
something lingering in GeoServer after the first configuration that then
kills the second.
We are planning on upgrading to 2.1.4 soon, and maybe this will magically
fix the issue, but I would very much like to get to the bottom of this
problem.
Any suggestions on where to start would be very much appreciated!
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/REST-create-data-store-NullPointerException-on-second-run-tp4987387.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users