[Geoserver-users] error in creating a datatstore of dbtype app-schema with shapefile source

I started with a configuration using a .properties file for the datastore, and that was working correctly.

Then I changed the mapping file to use a shapefile instead, following the manual

                <sourceDataStores>
                    <DataStore>
                        <id>datastore</id>
                        <parameters>
                            <Parameter>
                                <name>url</name>
                                <value>file:\C:\GeoServer_2.0.2\data_dir_app-schema\data\shapefiles\states.shp</value>
                            </Parameter>
                            <Parameter>
                                <name>memory mapped buffer</name>
                                <value>false</value>
                            </Parameter>
                            <Parameter>
                                <name>create spatial index</name>
                                <value>true</value>
                            </Parameter>
                            <Parameter>
                                <name>charset</name>
                                <value>ISO-8859-1</value>
                            </Parameter>
                        </parameters>
                    </DataStore>
                </sourceDataStores>

I assume that the sourceType element also needs to be modified, so I used
<sourceType>states</sourceType>
although I couldn't find specifics for this element in the case of shapefiles.

When I try to create the datastore, I get this error

Error creating data store, check the parameters. Error message: Cannot find a DataAccess for parameters (some not shown) {url=\C:\GeoServer_2.0.2\data_dir_app-schema\data\shapefiles\states.shp}

Any suggestions are appreciated.

Tara

Please don't use backslashes in URLs. Forward slashes are reported to work (like this):
<value>file:/D:/Workspace/shapefiles/VerdeRiverBuffer.shp</value>

(From here:)
http://docs.geoserver.org/trunk/en/user/data/app-schema/data-stores.html#shapefile

Kind regards,
Ben.

On 26/07/10 04:44, Tara Athan wrote:

I started with a configuration using a .properties file for the
datastore, and that was working correctly.

Then I changed the mapping file to use a shapefile instead, following
the manual

                 <sourceDataStores>
                     <DataStore>
                         <id>datastore</id>
                         <parameters>
                             <Parameter>
                                 <name>url</name>

<value>file:\C:\GeoServer_2.0.2\data_dir_app-schema\data\shapefiles\states.shp</value>
                             </Parameter>
                             <Parameter>
                                 <name>memory mapped buffer</name>
                                 <value>false</value>
                             </Parameter>
                             <Parameter>
                                 <name>create spatial index</name>
                                 <value>true</value>
                             </Parameter>
                             <Parameter>
                                 <name>charset</name>
                                 <value>ISO-8859-1</value>
                             </Parameter>
                         </parameters>
                     </DataStore>
                 </sourceDataStores>

I assume that the sourceType element also needs to be modified, so I used
<sourceType>states</sourceType>
although I couldn't find specifics for this element in the case of
shapefiles.

When I try to create the datastore, I get this error

Error creating data store, check the parameters. Error message: Cannot
find a DataAccess for parameters (some not shown)
{url=\C:\GeoServer_2.0.2\data_dir_app-schema\data\shapefiles\states.shp}

Any suggestions are appreciated.

Tara

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <Ben.Caradoc-Davies@anonymised.com>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

> Please don't use backslashes in URLs. Forward slashes are reported to work (like this):
> <value>file:/D:/Workspace/shapefiles/VerdeRiverBuffer.shp</value>
Thanks for that suggestion.
However, I had already tried it both ways with no success, and same error, so something else is going on.
Specifics:
Version 2.0.2 from Windows Installer onto Windows XP SP3
default installation, except for change in data directory to path with no spaces
Access as localhost only
JDK 6.16

I have verified that the path to the shapefile is correct by copy-paste into Windows Explorer and browser.
The states shapefile is not corrupted- there is no problem in using it for a simple featuretype layer.

Other perturbations attempted
1. Using GUI (Add new datastore) to create the datastore directory and datastore.xml file (requires the mapping file to be in a separate directory, I use a mappingfiles directory as a sub-directory of the data directory)
2. Completely manual configuration, with the mapping file in the mappingfiles directory, or back in the conventional location under workspaces/...
3. Tried this format for url: file:///C:/GeoServer_2.0.2/data_dir_app-schema/data/shapefiles/states.shp, which is how the browser likes it.

In all cases the error is the same- Below is the log from startup with the completely manual configuration:
By the way, I notice that the prefix "file:" is stripped off in the error message
url=/C:/GeoServer_2.0.2/data_dir_app-schema/data/shapefiles/states.shp

Wondering if that is the source of the difficulty?

2010-07-26 08:09:13,250 ERROR [geoserver.global] -
----------------------------------
- GEOSERVER_DATA_DIR: C:\GeoServer_2.0.2\data_dir_app-schema
----------------------------------
2010-07-26 08:09:13,296 INFO [storage.DefaultStorageFinder] - *****************************************************************************************************************************************
2010-07-26 08:09:13,296 INFO [storage.DefaultStorageFinder] - *** Found Servlet context parameter GEOSERVER_DATA_DIR set to C:\GeoServer_2.0.2\data_dir_app-schema, using it as the default prefix. ***
2010-07-26 08:09:13,296 INFO [storage.DefaultStorageFinder] - *****************************************************************************************************************************************
2010-07-26 08:09:13,296 INFO [config.XMLConfiguration] - Failed to find geowebcache.xml. This is not a problem unless you are trying to use a custom XML configuration file.
2010-07-26 08:09:13,656 INFO [jdbc.JDBCMBWrapper] - MetaStore database is version 120
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded style 'line'
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded style 'point'
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded style 'polygon'
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded style 'raster'
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded default workspace gsml
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded workspace 'gsml'
2010-07-26 08:09:13,718 INFO [org.geoserver] - Loaded workspace 'topp_w'
2010-07-26 08:09:13,734 INFO [org.geoserver] - Loaded store 'gsml_GeologicUnit', enabled
2010-07-26 08:09:13,734 INFO [org.geoserver] - Loaded data store 'gsml_GeologicUnit'
2010-07-26 08:09:16,453 INFO [org.geoserver] - Loaded feature type 'GeologicUnit', enabled
2010-07-26 08:09:16,453 INFO [org.geoserver] - Loaded feature type 'gsml_GeologicUnit'
2010-07-26 08:09:16,468 INFO [org.geoserver] - Loaded layer 'GeologicUnit'
2010-07-26 08:09:16,468 INFO [org.geoserver] - Loaded store 'states_shapefile', enabled
2010-07-26 08:09:16,468 INFO [org.geoserver] - Loaded data store 'states_shapefile'
2010-07-26 08:09:16,500 INFO [org.geoserver] - Loaded feature type 'states', enabled
2010-07-26 08:09:16,500 INFO [org.geoserver] - Loaded feature type 'states_shapefile'
2010-07-26 08:09:16,500 INFO [org.geoserver] - Loaded layer 'states'
2010-07-26 08:09:16,515 INFO [org.geoserver] - Loaded store 'taz_shapes', enabled
2010-07-26 08:09:16,515 INFO [org.geoserver] - Loaded data store 'taz_shapes'
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded feature type 'tasmania_cities', enabled
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded feature type 'taz_shapes'
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded layer 'tasmania_cities'
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded feature type 'tasmania_roads', enabled
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded feature type 'taz_shapes'
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded layer 'tasmania_roads'
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded store 'topp_StatesUOM_d', enabled
2010-07-26 08:09:16,671 INFO [org.geoserver] - Loaded data store 'topp_StatesUOM_d'
2010-07-26 08:09:16,703 ERROR [complex.config] - Cannot find a DataAccess for parameters {memory mapped buffer=false, create spatial index=true, charset=ISO-8859-1, url=/C:/GeoServer_2.0.2/data_dir_app-schema/data/shapefiles/states.shp}
2010-07-26 08:09:16,703 WARN [org.geoserver] - Error connecting to 'topp_StatesUOM_d'. Disabling.
2010-07-26 08:09:16,703 INFO [org.geoserver] -
org.geotools.data.DataSourceException: Cannot find a DataAccess for parameters (some not shown) {url=/C:/GeoServer_2.0.2/data_dir_app-schema/data/shapefiles/states.shp}
    at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.aquireSourceDatastores(AppSchemaDataAccessConfigurator.java:564)
    at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:180)
    at org.geotools.data.complex.config.AppSchemaDataAccessConfigurator.buildMappings(AppSchemaDataAccessConfigurator.java:157)
    at org.geotools.data.complex.AppSchemaDataAccessFactory.createDataStore(AppSchemaDataAccessFactory.java:93)
    at org.vfny.geoserver.util.DataStoreUtils.getDataAccess(DataStoreUtils.java:96)
    at org.geoserver.catalog.ResourcePool.getDataStore(ResourcePool.java:317)
    at org.geoserver.catalog.impl.DataStoreInfoImpl.getDataStore(DataStoreInfoImpl.java:37)
    at org.geoserver.config.GeoServerLoader.readCatalog(GeoServerLoader.java:581)
    at org.geoserver.config.GeoServerLoader.loadCatalog(GeoServerLoader.java:161)
    at org.geoserver.config.GeoServerLoader.postProcessBeforeInitialization(GeoServerLoader.java:132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:495)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:162)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:540)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:135)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:510)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
    at org.mortbay.jetty.Server.doStart(Server.java:222)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
    at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:977)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mortbay.start.Main.invokeMain(Main.java:183)
    at org.mortbay.start.Main.start(Main.java:497)
    at org.mortbay.start.Main.main(Main.java:115)
2010-07-26 08:09:16,703 INFO [org.geoserver] - Loaded feature type 'StatesUOM_F', enabled
2010-07-26 08:09:16,765 INFO [org.geoserver] - Loaded feature type 'topp_StatesUOM_d'
2010-07-26 08:09:16,765 INFO [org.geoserver] - Loaded layer 'StatesUOM_F'
2010-07-26 08:09:16,937 INFO [layer.TileLayerDispatcher] - ConfigurationLoader acquired lock, sleeping 5 seconds
2010-07-26 08:09:16,953 INFO [geowebcache.GeoWebCacheDispatcher] - Invoked setServletPrefix(gwc)
2010-07-26 08:09:16,953 INFO [wms.WMSService] - Will NOT recombine tiles for non-tiling clients.
2010-07-26 08:09:16,953 INFO [wms.WMSService] - Will proxy requests to backend that are not getmap or getcapabilities.
2010-07-26 08:09:16,968 INFO [wfs.WFSService] - Configured to forward to http://localhost:8080/geoserver/wfs , timeout is 600000ms regex filter
2010-07-26 08:09:17,031 INFO [rest.RESTDispatcher] - Created RESTDispatcher with 7 paths
2010-07-26 08:09:17,093 INFO [org.geoserver] - Loaded service 'wcs', enabled
2010-07-26 08:09:17,109 INFO [org.geoserver] - Loaded service 'wfs', enabled
2010-07-26 08:09:17,140 INFO [org.geoserver] - Loaded service 'wms', enabled
2010-07-26 08:09:18,937 INFO [layer.TileLayerDispatcher] - ConfigurationLoader woke up, initializing
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding layers from GeoServer Catalog Listener
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding: gsml:GeologicUnit
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding: topp_w:states
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding: topp_w:tasmania_cities
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding: topp_w:tasmania_roads
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding: topp_w:StatesUOM_F
2010-07-26 08:09:19,109 ERROR [config.XMLConfiguration] - Configuration file cannot be read or does not exist!
2010-07-26 08:09:19,109 INFO [config.XMLConfiguration] - Found configuration file in C:\Program Files\GeoServer 2.0.2\webapps\geoserver\..\resources
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - Adding layers from C:\Program Files\GeoServer 2.0.2\webapps\geoserver\..\resources
2010-07-26 08:09:19,109 ERROR [layer.TileLayerDispatcher] - Configuration C:\Program Files\GeoServer 2.0.2\webapps\geoserver\..\resources contained no layers.
2010-07-26 08:09:19,109 INFO [config.XMLConfiguration] - Found configuration file in C:\Program Files\GeoServer 2.0.2\webapps\geoserver\..\resources
2010-07-26 08:09:19,109 ERROR [layer.TileLayerDispatcher] - Error reading service information from C:\Program Files\GeoServer 2.0.2\webapps\geoserver\..\resources: Error parsing file C:\Program Files\GeoServer 2.0.2\webapps\geoserver\..\resources\geowebcache.xml
2010-07-26 08:09:19,109 INFO [layer.TileLayerDispatcher] - ConfigurationLoader completed
2010-07-26 08:09:43,625 ERROR [complex.config] - Cannot find a DataAccess for parameters {memory mapped buffer=false, create spatial index=true, charset=ISO-8859-1, url=/C:/GeoServer_2.0.2/data_dir_app-schema/data/shapefiles/states.shp}

Ben Caradoc-Davies wrote:

Please don't use backslashes in URLs. Forward slashes are reported to work (like this):
<value>file:/D:/Workspace/shapefiles/VerdeRiverBuffer.shp</value>

(From here:)
http://docs.geoserver.org/trunk/en/user/data/app-schema/data-stores.html#shapefile

Kind regards,
Ben.

On 26/07/10 04:44, Tara Athan wrote:

I started with a configuration using a .properties file for the
datastore, and that was working correctly.

Then I changed the mapping file to use a shapefile instead, following
the manual

                 <sourceDataStores>
                     <DataStore>
                         <id>datastore</id>
                         <parameters>
                             <Parameter>
                                 <name>url</name>

<value>file:\C:\GeoServer_2.0.2\data_dir_app-schema\data\shapefiles\states.shp</value>

                             </Parameter>
                             <Parameter>
                                 <name>memory mapped buffer</name>
                                 <value>false</value>
                             </Parameter>
                             <Parameter>
                                 <name>create spatial index</name>
                                 <value>true</value>
                             </Parameter>
                             <Parameter>
                                 <name>charset</name>
                                 <value>ISO-8859-1</value>
                             </Parameter>
                         </parameters>
                     </DataStore>
                 </sourceDataStores>

I assume that the sourceType element also needs to be modified, so I used
<sourceType>states</sourceType>
although I couldn't find specifics for this element in the case of
shapefiles.

When I try to create the datastore, I get this error

Error creating data store, check the parameters. Error message: Cannot
find a DataAccess for parameters (some not shown)
{url=\C:\GeoServer_2.0.2\data_dir_app-schema\data\shapefiles\states.shp}

Any suggestions are appreciated.

Tara

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

This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Tara Athan
Owner, Athan Ecological Reconciliation Services
tara_athan at alt2is.com
707-272-2115 (cell, preferred)
707-485-1198 (office)
249 W. Gobbi St. #A
Ukiah, CA 95482

OK, managed to track this one down.

There is a bug in the geotools app-schema module that causes the "file:" prefix to be stripped off the url for absolute paths, but not for relative paths. This prefix is required for the "shapefile" type of datastore, so the workaround is to only use relative paths to the shapefile in the app-schema mapping file.

I will submit a bug-report and patch to geotools, but the app-schema module is "unsupported", so I'm not sure how that will go. Also not sure about how fast fixes in geotools trickled down into geoserver?

Maybe it is worthwhile adding a note to the app-schema documentation about this?

Tara