ngageoint / elasticgeo

ElasticGeo provides a GeoTools data store that allows geospatial features from an Elasticsearch index to be published via OGC services using GeoServer.
GNU General Public License v3.0
169 stars 85 forks source link

Build and startup issues #55

Closed arenger closed 6 years ago

arenger commented 6 years ago

Thank you for creating this geoserver extension... I'm excited to try it out!

I'm running into two different problems. First, mvn install -DskipTests=true -Dskip.integration.tests=true doesn't work for me, when running within the gt-elasticsearch directory. Maven can't find mil.nga.giat:joda-shaded. Is there a repository that I should add to my settings.xml?

Could not find artifact mil.nga.giat:joda-shaded:jar:2.12-SNAPSHOT in maven2-repository.dev.java.net (http://download.java.net/maven/2)

I tried downloading a pre-compiled binary from https://github.com/ngageoint/elasticgeo/releases (I downloaded 2.12.0-RC1), but when I add it to my WEB-INF/lib directory, restart, and attempt to add a new data source, the following error occurs:

org.apache.wicket.WicketRuntimeException: Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener targeted at org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1@210bc861 on component [AjaxSubmitLink [Component id = save]] threw an exception at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:268) at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248) at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
...
Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) ... 113 more Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z
...

Likely stemming from an incompatibility of Jackson/json libraries.

Do you have any suggestions? I'm using GeoServer 2.12.0 and Java 1.8.0_151

arenger commented 6 years ago

Please disregard the first issue. I neglected the fact that joda-shaded is a peer directory to gs-web-elasticsearch... so I'm able to build it now.

However, I've still not resolved the issue regarding compatibility between pre-compiled binary 2.12.0-RC1 and GeoServer 2.12.0. The same stack trace is returned when using 2.12.0-RC1 and when building from 11812d8.

arenger commented 6 years ago

When I revert to 2.10.1-RC1 of this repository, it works with GeoServer 12.2. Now there are issues attempting the connection to ElasticSearch, so I'm downgrading my ElasticSearch version to 2.4.6, in effort to appease the TransportClient's connection preferences.

sjudeng commented 6 years ago

I'm not able to reproduce this. Is it on Linux, Windows or OS X? Is it a default GeoServer installation or have you installed other custom plugins? I tested without issue using GeoServer 2.12.1 (web archive/war) and elasticgeo-2.12.0 in Tomcat 8.5.24.

arenger commented 6 years ago

Thanks for replying, @sjudeng! I'm using Tomcat 8.0.47 and GeoServer 2.12.0 in a Docker environment. When I build the latest gs-web-elasticsearch jars I still receive the jackson ClassNotFound exceptions. However, when I build the 2.10.1-RC1 version of gs-web-elasticsearch it works fine. As for connecting to ElasticSearch, I resolved that issue too... I needed to enable transport client connections by adding transport.host: 0.0.0.0 to my elasticsearch.yml file. (Currently I'm using ElasticSearch 5.6.5)

Now the only problem I have is that the Layer Preview in GeoServer doesn't show any data, after I successfully add and publish an ElasticSearch datasource. I'm going to try a direct WFS query to see if I can hone in whether this is due to incompatibility or misconfiguration...

arenger commented 6 years ago

Here's a docker-compose, if you would like to build 2.12.0-RC1 of gs-web-elasticsearch and see if you can reproduce the jackson error:

version: '2'

services:

  geoserver:
    image: kartoza/geoserver:2.12.0
    hostname: geoserver
    ports:
      - "8080:8080"
    restart: unless-stopped
    user: root
    depends_on:
      - es

  es:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.5
    ports:
      - "9200:9200"

I double-checked just now (after rebuilding from master [11812d8]) and starting the containers fresh... and received the following stack trace:

org.apache.wicket.WicketRuntimeException: Method onRequest of interface org.apache.wicket.behavior.IBehaviorListener...
  at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:268)
  at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
  at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248)
  at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234)
...
Caused by: java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
...  113 more
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.JavaType.isReferenceType()Z
  at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:400)
...
sjudeng commented 6 years ago

I pushed an update that should resolve the issue. See https://github.com/ngageoint/elasticgeo/pull/56/commits/ab4f0034c81d0e25f056c32af25a9051ebf15e16 and the 2.12.1-RC1 release.

GeoServer 2.12.0 added an older jackson-core-2.5.0 as a dependency, which conflicts with the version bundled in the plugin. The plugin appears to be compatible with the earlier Jackson but GeoServer isn't compatible with the newer version. For some reason when deploying through Docker the plugin (and newer Jackson) precedes the earlier Jackson on the classpath which causes the error.

arenger commented 6 years ago

Yep, it's fixed! I built from 2.12.1-RC1 and redeployed with GeoServer 2.12.0 and I'm able to add a new ElasticSearch datastore without error. Thanks @sjudeng!