无法在Solr 6.4.2上安装jts库

时间:2017-03-11 12:28:41

标签: solr jetty polygon jts

我刚刚安装了Solr-6.4.2并尝试通过将所有JTS库文件复制到/solr-6.4.2/server/solr-webapp/WEB-INF/lib目录来安装JTS库like here explained

然后通过添加

配置托管模式
  <fieldType name="location_rpt"   class="solr.SpatialRecursivePrefixTreeFieldType"
           spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
           distErrPct="0.025"
           maxDistErr="0.000009"
           units="degrees"
        />

<field name="geo"  type="location_rpt"  indexed="true" stored="true"  multiValued="true" />  

并使用./solr start(jetty)

在/ bin中启动它

但是当我访问solr界面时,它说:

> org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
> Could not load conf for core polygon: Can't load schema
> /home/spatial/solr-6.4.2/server/solr/polygon/conf/managed-schema:
> Plugin Initializing failure for [schema.xml] fieldType

在我看来,未找到或未自动加载库(因为它应该根据教程)。

你能帮帮我吗? 这是日志文件:

2017-03-11 15:44:57.061 INFO  (main) [   ] o.a.s.c.CorePropertiesLocator Cores are: [polygon]
2017-03-11 15:44:57.067 INFO  (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.c.SolrResourceLoader [null] Added 8 libs to classloader, from paths: [/home/spatial/solr-6.4.2/server/solr/polygon/lib]
2017-03-11 15:44:57.117 INFO  (main) [   ] o.e.j.s.Server Started @777ms
2017-03-11 15:44:57.174 INFO  (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.c.SolrResourceLoader [polygon] Added 59 libs to classloader, from paths: [/home/spatial/solr-6.4.2/contrib/clustering/lib, /home/spatial/solr-6.4.2/contrib/extraction/lib, /home/spatial/solr-6.4.2/contrib/langid/lib, /home/spatial/solr-6.4.2/contrib/velocity/lib, /home/spatial/solr-6.4.2/dist]
2017-03-11 15:44:57.209 INFO  (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.c.SolrConfig Using Lucene MatchVersion: 6.4.2
2017-03-11 15:44:57.298 INFO  (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.s.IndexSchema [polygon] Schema name=example-data-driven-schema
2017-03-11 15:44:57.385 WARN  (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.c.SolrResourceLoader Solr loaded a deprecated plugin/analysis class [solr.SynonymFilterFactory]. Please consult documentation how to replace it accordingly.
2017-03-11 15:44:57.535 WARN  (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.s.AbstractSpatialFieldType Replace 'com.spatial4j.core' with 'org.locationtech.spatial4j' in your schema.
2017-03-11 15:44:57.556 ERROR (coreLoadExecutor-6-thread-1) [   x:polygon] o.a.s.c.CoreContainer Error creating core [polygon]: Could not load conf for core polygon: Can't load schema /home/spatial/solr-6.4.2/server/solr/polygon/conf/managed-schema: Plugin Initializing failure for [schema.xml] fieldType
org.apache.solr.common.SolrException: Could not load conf for core polygon: Can't load schema /home/spatial/solr-6.4.2/server/solr/polygon/conf/managed-schema: Plugin Initializing failure for [schema.xml] fieldType
    at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:84)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:888)
    at org.apache.solr.core.CoreContainer.lambda$load$3(CoreContainer.java:542)
    at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: Can't load schema /home/spatial/solr-6.4.2/server/solr/polygon/conf/managed-schema: Plugin Initializing failure for [schema.xml] fieldType
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:598)
    at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:183)
    at org.apache.solr.schema.ManagedIndexSchema.<init>(ManagedIndexSchema.java:104)
    at org.apache.solr.schema.ManagedIndexSchemaFactory.create(ManagedIndexSchemaFactory.java:173)
    at org.apache.solr.schema.ManagedIndexSchemaFactory.create(ManagedIndexSchemaFactory.java:45)
    at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:75)
    at org.apache.solr.core.ConfigSetService.createIndexSchema(ConfigSetService.java:106)
    at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:78)
    ... 8 more
Caused by: org.apache.solr.common.SolrException: Plugin Initializing failure for [schema.xml] fieldType
    at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:194)
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:491)
    ... 15 more
Caused by: java.lang.RuntimeException: schema fieldtype location_rpt(org.apache.solr.schema.SpatialRecursivePrefixTreeFieldType) invalid arguments:{units=degrees}
    at org.apache.solr.schema.FieldType.setArgs(FieldType.java:202)
    at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:165)
    at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:53)
    at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:191)
    ... 16 more
2017-03-11 15:44:57.558 ERROR (coreContainerWorkExecutor-2-thread-1) [   ] o.a.s.c.CoreContainer Error waiting for SolrCore to be created
java.util.concurrent.ExecutionException: org.apache.solr.common.SolrException: Unable to create core [polygon]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.solr.core.CoreContainer.lambda$load$4(CoreContainer.java:570)
    at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:229)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: Unable to create core [polygon]
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:903)
    at org.apache.solr.core.CoreContainer.lambda$load$3(CoreContainer.java:542)
    at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197)
    ... 5 more
Caused by: org.apache.solr.common.SolrException: Could not load conf for core polygon: Can't load schema /home/spatial/solr-6.4.2/server/solr/polygon/conf/managed-schema: Plugin Initializing failure for [schema.xml] fieldType
    at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:84)
    at org.apache.solr.core.CoreContainer.create(CoreContainer.java:888)
    ... 7 more
Caused by: org.apache.solr.common.SolrException: Can't load schema /home/spatial/solr-6.4.2/server/solr/polygon/conf/managed-schema: Plugin Initializing failure for [schema.xml] fieldType
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:598)
    at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:183)
    at org.apache.solr.schema.ManagedIndexSchema.<init>(ManagedIndexSchema.java:104)
    at org.apache.solr.schema.ManagedIndexSchemaFactory.create(ManagedIndexSchemaFactory.java:173)
    at org.apache.solr.schema.ManagedIndexSchemaFactory.create(ManagedIndexSchemaFactory.java:45)
    at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:75)
    at org.apache.solr.core.ConfigSetService.createIndexSchema(ConfigSetService.java:106)
    at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:78)
    ... 8 more
Caused by: org.apache.solr.common.SolrException: Plugin Initializing failure for [schema.xml] fieldType
    at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:194)
    at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:491)
    ... 15 more
Caused by: java.lang.RuntimeException: schema fieldtype location_rpt(org.apache.solr.schema.SpatialRecursivePrefixTreeFieldType) invalid arguments:{units=degrees}
    at org.apache.solr.schema.FieldType.setArgs(FieldType.java:202)
    at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:165)
    at org.apache.solr.schema.FieldTypePluginLoader.init(FieldTypePluginLoader.java:53)
    at org.apache.solr.util.plugin.AbstractPluginLoader.load(AbstractPluginLoader.java:191)

1 个答案:

答案 0 :(得分:1)

事实证明,接口最近已更改,并且在stackoverflow上找到的旧示例(如here)无法使用最新的solr版本(6.4.2)。最新文档是here

可以使用的配置示例:

  <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
    spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
    autoIndex="true"
    distErrPct="0.025"
    maxDistErr="0.001"
    distanceUnits="kilometers" />

予。即现在使用distanceUnits代替units等,而degrees属性似乎会引发错误。

我使用的初始代码在最新的solr版本中引发了错误。

Caused by: java.lang.RuntimeException: schema fieldtype location_rpt(org.apache.solr.schema.SpatialRecursivePrefixTreeFieldType) invalid arguments:{units=degrees}