Geoserver - elasticsearch layer is not created

旧街凉风 提交于 2020-01-07 02:15:13

问题


I am very new to geoserver. Recently we have setup geoserver with elasticgeo plugin. Now I can see Elasticsearch option in Vector data sources while creating a new datastore.

Used below Rest API calls to create a workspace & data store.

scurl -v -k -u admin:geoserver -XPOST "https://localhost:6443/geoserver/rest/namespaces" -H "Content-type: text/xml" -d "<namespace><prefix>test</prefix><uri>http://test.com</uri></namespace>"


scurl -v -k -u admin:geoserver -XPOST "https://localhost:6443/geoserver/rest/workspaces/test/datastores" -H "Content-type: text/xml" -d '<dataStore>
<name>test123</name>
<type>Elasticsearch</type>
<enabled>true</enabled>
<connectionParameters>
    <entry key="cluster_name">elasticsearch</entry>
    <entry key="index_name">my_test</entry>
    <entry key="use_local_node">true</entry>
    <entry key="elasticsearch_host">localhost</entry>
    <entry key="elasticsearch_port">9300</entry>
    <entry key="store_data">false</entry>
</connectionParameters>

'

I can create a new elastisearch data store now using Elasticsearch option. But when I try to create a layer using below rest call, it throws the an error which is pasted at the end.

rest call for data layer:

scurl -v -k -u admin:geoserver -XPOST "https://localhost:6443/geoserver/rest/workspaces/test/datastores/test123/featuretypes.xml" -H "Content-type: text/xml" -d '<featureType>
<name>testl</name>
<nativeName>testl</nativeName>
<namespace>
    <name>test</name>
</namespace>
<title>testl</title>
<keywords>
    <string>testl</string>
    <string>features</string>
</keywords>
<nativeCRS>GEOGCS["WGS 84",   DATUM["World Geodetic System 1984",     SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],     AUTHORITY["EPSG","6326"]],   PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],   UNIT["degree", 0.017453292519943295],   AXIS["Geodetic longitude", EAST],   AXIS["Geodetic latitude", NORTH],   AUTHORITY["EPSG","4326"]]</nativeCRS>
<srs>EPSG:4326</srs>
<nativeBoundingBox>
    <minx>-180</minx>
    <maxx>180</maxx>
    <miny>-90</miny>
    <maxy>90</maxy>
    <crs>EPSG:4326</crs>
</nativeBoundingBox>
<latLonBoundingBox>
    <minx>-180</minx>
    <maxx>180</maxx>
    <miny>-90</miny>
    <maxy>90</maxy>
    <crs>EPSG:4326</crs>
</latLonBoundingBox>
<projectionPolicy>FORCE_DECLARED</projectionPolicy>
<enabled>true</enabled>
<metadata>
    <entry key="ElasticLayerConfiguration">
        <elasticLayerConfiguration>
            <layerName>testl</layerName>
            <attributes>
                <esAttribute>
                    <name>_id</name>
                    <shortName>_id</shortName>
                    <useShortName>false</useShortName>
                    <type>java.lang.String</type>
                    <use>true</use>
                    <defaultGeometry>false</defaultGeometry>
                    <analyzed>true</analyzed>
                    <stored>false</stored>
                    <nested>false</nested>
                </esAttribute>
                <esAttribute>
                    <name>path</name>
                    <shortName>path</shortName>
                    <useShortName>false</useShortName>
                    <type>com.vividsolutions.jts.geom.LineString</type>
                    <geometryType>GEO_SHAPE</geometryType>
                    <use>true</use>
                    <defaultGeometry>true</defaultGeometry>
                    <srid>4326</srid>
                    <stored>false</stored>
                    <nested>false</nested>
                </esAttribute>
                <esAttribute>
                    <name>Location_tag</name>
                    <shortName>Location_tag</shortName>
                    <useShortName>false</useShortName>
                    <type>java.lang.String</type>
                    <use>true</use>
                    <defaultGeometry>false</defaultGeometry>
                    <analyzed>true</analyzed>
                    <stored>false</stored>
                    <nested>false</nested>
                </esAttribute>
            </attributes>
        </elasticLayerConfiguration>
    </entry>
</metadata>
<store class="dataStore">
    <name>director-services</name>
</store>
<attributes>
    <attribute>
        <name>_id</name>
        <minOccurs>0</minOccurs>
        <maxOccurs>1</maxOccurs>
        <nillable>true</nillable>
        <binding>java.lang.String</binding>
    </attribute>
    <attribute>
        <name>path</name>
        <minOccurs>0</minOccurs>
        <maxOccurs>1</maxOccurs>
        <nillable>true</nillable>
        <binding>com.vividsolutions.jts.geom.LineString</binding>
    </attribute>
    <attribute>
        <name>Location_tag</name>
        <minOccurs>0</minOccurs>
        <maxOccurs>1</maxOccurs>
        <nillable>true</nillable>
        <binding>java.lang.String</binding>
    </attribute>
</attributes>

'

error:

HTTP/1.1 100 Continue
HTTP/1.1 500 Internal Server Error

error in logs:

2016-08-16 07:45:14,062 INFO [org.geoserver] - Loaded feature type 'testl', enabled
2016-08-16 07:45:14,062 WARN [catalog.impl] - Failed to load actual store for FeatureTypeInfoImpl[testl]
2016-08-16 07:45:14,062 ERROR [geoserver.rest] - :null
2016-08-16 07:45:14,063 ERROR [geoserver.rest] - 
org.geoserver.rest.RestletException: java.lang.UnsupportedOperationException
    at org.geoserver.rest.ReflectiveResource.handleException(ReflectiveResource.java:326)
    at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:124)
    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 org.geoserver.rest.RESTDispatcher$1.handle(RESTDispatcher.java:205)
    at com.noelios.restlet.ext.servlet.ServletConverter.service(ServletConverter.java:129)
    at org.geoserver.rest.RESTDispatcher.handleRequestInternal(RESTDispatcher.java:87)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:75)
    at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:71)
    at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:71)
    at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:46)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:50)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:54)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
    at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92)
    at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:83)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:53)
    at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:73)
    at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
    at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:135)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:83)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:42)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:48)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:44)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.UnsupportedOperationException
    at org.geotools.data.store.ContentDataStore.createSchema(ContentDataStore.java:325)
    at org.geotools.data.store.ContentDataStore.createSchema(ContentDataStore.java:103)
    at org.geoserver.catalog.rest.FeatureTypeResource.handleObjectPost(FeatureTypeResource.java:137)
    at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:121)
    ... 95 more

Can anyone help me where I am going wrong.


回答1:


From reading the source code here: https://github.com/ngageoint/elasticgeo, it looks like Elastic Geo doesn't implement the createSchema method.

There are a number of GeoTools datastore implementation which are 'read-only' and do allow for creating new layers and/or updating data. I believe the current implementation of the Solr datastore is in a similar state.

If you already have data in ElasticSearch, you should be able to use the GeoServer web UI to register the layer. As a note, the directions point to using a more complex ui, so it might be more challenging to register the layer via the REST interface. Check out https://github.com/ngageoint/elasticgeo/blob/master/gs-web-elasticsearch/doc/index.rst for more details.



来源:https://stackoverflow.com/questions/38990413/geoserver-elasticsearch-layer-is-not-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!