我在Windows上启动Solr实例时遇到困难,我需要将其从SQL服务器中拉出,因此我正在运行mySQL服务器,尝试从那里将数据提取到Solr中。添加了一个DataImportHandler,很可能是导致错误的原因。
以下是错误日志片段:
2018-08-29 14:14:08.732 INFO (main) [ ] o.e.j.s.Server Started @3179ms
2018-08-29 14:14:08.738 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.s.IndexSchema [phones] Schema name=default-config
2018-08-29 14:14:09.037 INFO (qtp1708570683-22) [ ] o.a.s.s.HttpSolrCall [admin] webapp=null path=/admin/info/system params={wt=json} status=0 QTime=121
2018-08-29 14:14:09.125 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.s.IndexSchema Loaded schema default-config/1.6 with uniqueid field id
2018-08-29 14:14:09.278 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.c.CoreContainer Creating SolrCore 'phones' using configuration from instancedir C:\Program Files\solr-7.4.0\server\solr\phones, trusted=true
2018-08-29 14:14:09.288 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.m.r.SolrJmxReporter JMX monitoring for 'solr.core.phones' (registry 'solr.core.phones') enabled at server: com.sun.jmx.mbeanserver.JmxMBeanServer@146044d7
2018-08-29 14:14:09.298 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.c.SolrCore solr.RecoveryStrategy.Builder
2018-08-29 14:14:09.305 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.c.SolrCore [[phones] ] Opening new SolrCore at [C:\Program Files\solr-7.4.0\server\solr\phones], dataDir=[C:\Program Files\solr-7.4.0\server\solr\phones\data\]
2018-08-29 14:14:09.343 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.r.XSLTResponseWriter xsltCacheLifetimeSeconds=5
2018-08-29 14:14:09.772 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.c.SolrCore [phones] CLOSING SolrCore org.apache.solr.core.SolrCore@1abe108d
2018-08-29 14:14:09.773 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.m.SolrMetricManager Closing metric reporters for registry=solr.core.phones, tag=1abe108d
2018-08-29 14:14:09.774 INFO (coreLoadExecutor-9-thread-1) [ x:phones] o.a.s.m.r.SolrJmxReporter Closing reporter [org.apache.solr.metrics.reporters.SolrJmxReporter@45ba1c52: rootName = null, domain = solr.core.phones, service url = null, agent id = null] for registry solr.core.phones / com.codahale.metrics.MetricRegistry@1ecdf5a8
2018-08-29 14:14:09.786 ERROR (coreContainerWorkExecutor-2-thread-1) [ ] o.a.s.c.CoreContainer Error waiting for SolrCore to be loaded on startup
org.apache.solr.common.SolrException: Unable to create core [phones]
at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1156) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.CoreContainer.lambda$load$13(CoreContainer.java:681) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197) ~[metrics-core-3.2.6.jar:3.2.6]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_181]
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:209) ~[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:14]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_181]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
Caused by: org.apache.solr.common.SolrException: org/apache/solr/common/SolrException
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1012) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:867) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1135) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
... 7 more
Caused by: java.lang.NoClassDefFoundError: org/apache/solr/common/SolrException
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_181]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_181]
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:541) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:488) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:790) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.PluginBag.createPlugin(PluginBag.java:141) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.PluginBag.init(PluginBag.java:277) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:130) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:970) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:867) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1135) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.solr.common.SolrException
at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_181]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_181]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_181]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_181]
at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_181]
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:541) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:488) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:790) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.PluginBag.createPlugin(PluginBag.java:141) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.PluginBag.init(PluginBag.java:277) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:130) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:970) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:867) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1135) ~[solr-core-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc - jpountz - 2018-06-18 16:55:13]
... 7 more
solrconfig片段,因为整个过程都很大:
<lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-cell-\d.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/contrib/clustering/lib/" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-clustering-\d.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
<lib dir="${solr.install.dir:../../../..}/contrib/dataimporthandler" regex=".*\.jar" />
<!--<lib dir="../../../contrib/dataimporthandler/lib" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-dataimporthandler-.*\.jar" /> -->
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">C:/Program Files/solr-7.4.0/server/solr/phones/conf/data-config.xml</str>
</lst>
</requestHandler>
数据配置片段:
<dataConfig>
<dataSource name="jdbc" type="JdbcDataSource"
driver="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?useSSL=false&serverTimezone=GMT;DatabaseName=test"
user="test"
password="test123"/>
<document>
<entity name="phone" pk="id" dataSource="jdbc"
query="SELECT id,name,storage,colour,network,quality,date_modified_price FROM phones
WHERE '${dataimporter.request.clean}' != 'false'
OR last_modified > '${dataimporter.last_index_time}'
">
<field column="id" name="id"/>
<field column="name" name="name"/>
<field column="storage" name="storage"/>
<field column="colour" name="colour"/>
<field column="network" name="network"/>
<field column="quality" name="quality"/>
<field column="last_modified" name="last_modified"/>
<field column="price" name="price"/>
</entity>
</document>
</dataConfig>
答案 0 :(得分:0)
在某些情况下,JDBC驱动程序已更新,而引用已更改。在源代码中使用新的驱动程序替换了该名称的所有实例。