简体   繁体   中英

org.apache.solr.common.SolrException: Unable to create core

I'm having difficulty launching a Solr instance on Windows, I need it to pull from an SQL server so I'm running a mySQL server trying to extract data into Solr from there. A DataImportHandler has been added and it's likely this is causing the error.

The following is the error log snip:

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

The solrconfig snip, since the entire thing is quite large:

<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>

data-config snip:

<dataConfig>
    <dataSource name="jdbc" type="JdbcDataSource" 
            driver="com.mysql.cj.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/test?useSSL=false&amp;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>

It was the case that at some point the JDBC driver was updated and the reference changed. Replacing all instances of that name with the new driver within the source code worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM