我正在尝试将Apache Solr与我的Django博客应用程序集成。我正在使用从https://archive.apache.org/dist/lucene/solr/4.10.4/下载的Apache Solr 4.10.4。我通过在终端中键入java -jar start.jar
作为普通用户在终端中启动了Solr。我尝试使用以下参数创建一个新核心:
但是我在创建核心时遇到错误:
Error CREATEing SolrCore 'blog': Unable to create core [blog] Caused by: null
当初始化时也会出现以下错误:
SolrCore Initialization Failures
blog: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException
Please check your logs for more information
~/Downloads/solr-4.10.4/example/solr/blog
中的目录结构:
pecan@tux ~/Downloads/solr-4.10.4/example/solr $ tree blog
blog
├── conf
│ ├── lang
│ │ └── stopwords_en.txt
│ ├── protwords.txt
│ ├── schema.xml
│ ├── solrconfig.xml
│ ├── stopwords.txt
│ └── synonyms.txt
├── data
│ └── index
│ ├── segments_1
│ ├── segments.gen
│ └── write.lock
├── nfa_regexp_debug.log
├── nfa_regexp_dump.log
└── nfa_regexp_run.log
4 directories, 12 files
日志:
INFO - 2017-09-23 01:29:35.259; org.apache.solr.core.SolrCore; [collection1] Registered new searcher Searcher@52aa6e23[collection1] main{StandardDirectoryReader(segments_1:1:nrt)}
INFO - 2017-09-23 01:29:41.200; org.apache.solr.servlet.SolrDispatchFilter; [admin] webapp=null path=/admin/cores params={indexInfo=false&wt=json&_=1506122981159} status=0 QTime=1
INFO - 2017-09-23 01:29:41.351; org.apache.solr.servlet.SolrDispatchFilter; [admin] webapp=null path=/admin/info/system params={wt=json&_=1506122981247} status=0 QTime=58
INFO - 2017-09-23 01:29:41.381; org.apache.solr.servlet.SolrDispatchFilter; [admin] webapp=null path=/admin/cores params={wt=json&_=1506122981363} status=0 QTime=2
INFO - 2017-09-23 01:29:47.877; org.apache.solr.handler.admin.CoreAdminHandler; core create command schema=schema.xml&dataDir=data&name=blog&indexInfo=false&action=CREATE&collection=&shard=&wt=json&instanceDir=blog&config=solrconfig.xml&_=1506122987848
INFO - 2017-09-23 01:29:47.879; org.apache.solr.core.SolrResourceLoader; new SolrResourceLoader for directory: 'solr/blog/'
INFO - 2017-09-23 01:29:47.887; org.apache.solr.core.SolrConfig; Using Lucene MatchVersion: 3.6.0
INFO - 2017-09-23 01:29:47.894; org.apache.solr.core.SolrConfig; Loaded SolrConfig: solrconfig.xml
INFO - 2017-09-23 01:29:47.895; org.apache.solr.schema.IndexSchema; Reading Solr Schema from solr/blog/conf/schema.xml
INFO - 2017-09-23 01:29:47.897; org.apache.solr.schema.IndexSchema; [blog] Schema name=default
WARN - 2017-09-23 01:29:47.898; org.apache.solr.schema.IndexSchema; no uniqueKey specified in schema.
INFO - 2017-09-23 01:29:47.899; org.apache.solr.core.CoreContainer; Creating SolrCore 'blog' using configuration from instancedir solr/blog/
INFO - 2017-09-23 01:29:47.899; org.apache.solr.core.SolrCore; solr.NRTCachingDirectoryFactory
INFO - 2017-09-23 01:29:47.900; org.apache.solr.core.SolrCore; [blog] Opening new SolrCore at solr/blog/, dataDir=/home/pecan/Downloads/solr-4.10.4/example/solr/blog/data/
INFO - 2017-09-23 01:29:47.900; org.apache.solr.core.SolrCore; JMX monitoring not detected for core: blog
INFO - 2017-09-23 01:29:47.900; org.apache.solr.core.CachingDirectoryFactory; return new directory for /home/pecan/Downloads/solr-4.10.4/example/solr/blog/data
INFO - 2017-09-23 01:29:47.900; org.apache.solr.core.SolrCore; New index directory detected: old=null new=/home/pecan/Downloads/solr-4.10.4/example/solr/blog/data/index/
INFO - 2017-09-23 01:29:47.901; org.apache.solr.core.CachingDirectoryFactory; return new directory for /home/pecan/Downloads/solr-4.10.4/example/solr/blog/data/index
INFO - 2017-09-23 01:29:47.901; org.apache.solr.core.SolrCore; no updateRequestProcessorChain defined as default, creating implicit default
INFO - 2017-09-23 01:29:47.902; org.apache.solr.core.RequestHandlers; created /update: org.apache.solr.handler.UpdateRequestHandler
INFO - 2017-09-23 01:29:47.902; org.apache.solr.core.RequestHandlers; created /update/json: org.apache.solr.handler.UpdateRequestHandler
INFO - 2017-09-23 01:29:47.902; org.apache.solr.core.RequestHandlers; created /update/csv: org.apache.solr.handler.UpdateRequestHandler
INFO - 2017-09-23 01:29:47.902; org.apache.solr.core.RequestHandlers; created /update/json/docs: org.apache.solr.handler.UpdateRequestHandler
INFO - 2017-09-23 01:29:47.903; org.apache.solr.core.RequestHandlers; created /select: solr.StandardRequestHandler
WARN - 2017-09-23 01:29:47.903; org.apache.solr.core.RequestHandlers; Multiple requestHandler registered to the same name: /update ignoring: org.apache.solr.handler.UpdateRequestHandler
INFO - 2017-09-23 01:29:47.904; org.apache.solr.core.RequestHandlers; created /update: solr.UpdateRequestHandler
INFO - 2017-09-23 01:29:47.906; org.apache.solr.core.RequestHandlers; created /admin: solr.admin.AdminHandlers
INFO - 2017-09-23 01:29:47.906; org.apache.solr.core.RequestHandlers; created /admin/ping: solr.PingRequestHandler
INFO - 2017-09-23 01:29:47.906; org.apache.solr.handler.loader.XMLLoader; xsltCacheLifetimeSeconds=60
INFO - 2017-09-23 01:29:47.907; org.apache.solr.handler.loader.XMLLoader; xsltCacheLifetimeSeconds=60
INFO - 2017-09-23 01:29:47.908; org.apache.solr.handler.loader.XMLLoader; xsltCacheLifetimeSeconds=60
INFO - 2017-09-23 01:29:47.908; org.apache.solr.handler.loader.XMLLoader; xsltCacheLifetimeSeconds=60
INFO - 2017-09-23 01:29:47.908; org.apache.solr.handler.loader.XMLLoader; xsltCacheLifetimeSeconds=60
INFO - 2017-09-23 01:29:47.909; org.apache.solr.core.SolrCore; [blog] CLOSING SolrCore org.apache.solr.core.SolrCore@1cd813d
INFO - 2017-09-23 01:29:47.909; org.apache.solr.update.SolrCoreState; Closing SolrCoreState
INFO - 2017-09-23 01:29:47.909; org.apache.solr.update.DefaultSolrCoreState; SolrCoreState ref count has reached 0 - closing IndexWriter
INFO - 2017-09-23 01:29:47.909; org.apache.solr.core.SolrCore; [blog] Closing main searcher on request.
INFO - 2017-09-23 01:29:47.909; org.apache.solr.core.CachingDirectoryFactory; Closing NRTCachingDirectoryFactory - 2 directories currently being tracked
INFO - 2017-09-23 01:29:47.910; org.apache.solr.core.CachingDirectoryFactory; looking to close /home/pecan/Downloads/solr-4.10.4/example/solr/blog/data [CachedDir<<refCount=0;path=/home/pecan/Downloads/solr-4.10.4/example/solr/blog/data;done=false>>]
INFO - 2017-09-23 01:29:47.910; org.apache.solr.core.CachingDirectoryFactory; Closing directory: /home/pecan/Downloads/solr-4.10.4/example/solr/blog/data
INFO - 2017-09-23 01:29:47.911; org.apache.solr.core.CachingDirectoryFactory; looking to close /home/pecan/Downloads/solr-4.10.4/example/solr/blog/data/index [CachedDir<<refCount=0;path=/home/pecan/Downloads/solr-4.10.4/example/solr/blog/data/index;done=false>>]
INFO - 2017-09-23 01:29:47.911; org.apache.solr.core.CachingDirectoryFactory; Closing directory: /home/pecan/Downloads/solr-4.10.4/example/solr/blog/data/index
ERROR - 2017-09-23 01:29:47.912; org.apache.solr.core.CoreContainer; Error creating core [blog]: null
org.apache.solr.common.SolrException
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:881)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:654)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:491)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:466)
at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:575)
at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestInternal(CoreAdminHandler.java:199)
at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:188)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:729)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:258)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:368)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at org.apache.solr.common.params.SolrParams.toSolrParams(SolrParams.java:296)
at org.apache.solr.handler.RequestHandlerBase.init(RequestHandlerBase.java:111)
at org.apache.solr.handler.PingRequestHandler.init(PingRequestHandler.java:139)
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:184)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:800)
... 35 more
ERROR - 2017-09-23 01:29:47.914; org.apache.solr.common.SolrException; org.apache.solr.common.SolrException: Error CREATEing SolrCore 'blog': Unable to create core [blog] Caused by: null
at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:613)
at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestInternal(CoreAdminHandler.java:199)
at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:188)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:729)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:258)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:207)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:368)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.solr.common.SolrException: Unable to create core [blog]
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:507)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:466)
at org.apache.solr.handler.admin.CoreAdminHandler.handleCreateAction(CoreAdminHandler.java:575)
... 31 more
Caused by: org.apache.solr.common.SolrException
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:881)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:654)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:491)
... 33 more
Caused by: java.lang.NullPointerException
at org.apache.solr.common.params.SolrParams.toSolrParams(SolrParams.java:296)
at org.apache.solr.handler.RequestHandlerBase.init(RequestHandlerBase.java:111)
at org.apache.solr.handler.PingRequestHandler.init(PingRequestHandler.java:139)
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:184)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:800)
... 35 more
INFO - 2017-09-23 01:29:47.914; org.apache.solr.servlet.SolrDispatchFilter; [admin] webapp=null path=/admin/cores params={schema=schema.xml&dataDir=data&name=blog&indexInfo=false&action=CREATE&collection=&shard=&wt=json&instanceDir=blog&config=solrconfig.xml&_=1506122987848} status=400 QTime=37
INFO - 2017-09-23 01:29:52.951; org.apache.solr.servlet.SolrDispatchFilter; [admin] webapp=null path=/admin/cores params={indexInfo=false&wt=json&_=1506122992878} status=0 QTime=1
INFO - 2017-09-23 01:29:53.010; org.apache.solr.servlet.SolrDispatchFilter; [admin] webapp=null path=/admin/info/system params={wt=json&_=1506122992985} status=0 QTime=3
有人能告诉我我做错了吗?
答案 0 :(得分:2)
好的,让我们看看堆栈跟踪:
ERROR - 2017-09-23 01:29:47.912; org.apache.solr.core.CoreContainer; Error creating core [blog]: null
org.apache.solr.common.SolrException
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:881)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:654)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:491)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:466)
...SNIP...
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at org.apache.solr.common.params.SolrParams.toSolrParams(SolrParams.java:296)
at org.apache.solr.handler.RequestHandlerBase.init(RequestHandlerBase.java:111)
at org.apache.solr.handler.PingRequestHandler.init(PingRequestHandler.java:139)
at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:184)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:800)
... 35 more
显然,问题的原因是NPE。
并且,它似乎发生在将某些事物(参数)转换为SolrParams
对象。
线索#1:查看参数......
但是哪些?通过挖掘源代码等,我可以看到:
以下是源代码链接:
查看stacktrace中提到的具体行。
根据this documentation,&#34;不变量&#34;被指定为<requestHandler>
文件中solrconfig.xml
元素的一部分。
简而言之,solrconfig.xml
文件似乎存在问题。这导致启动器发送&#34; ping&#34;到参数格式错误的服务器。这会导致服务器报告错误。在请求中重复同样的事情,它试图创建名为&#34; blog&#34;的核心。
解决方案:根据Solr文档所说的内容检查solrconfig.xml
文件。修复配置问题。
元解决方案:学习阅读堆栈跟踪和源代码。关于使用开源应用程序,这是好事。如果出现问题,您可以阅读源代码以找出导致问题的原因。