1
votes

I'm trying to integrate Apache Solr with my Django blog application. I'm using Apache Solr 4.10.4 downloaded from https://archive.apache.org/dist/lucene/solr/4.10.4/. I started Solr in terminal by typing java -jar start.jar in terminal as normal user. I tried create a new core with following parameters:

  • name: blog
  • instanceDir: blog
  • dataDir: data
  • config: solrconfig.xml
  • schema: schema.xml

But I'm getting error while creating core:

 Error CREATEing SolrCore 'blog': Unable to create core [blog] Caused by: null

Also below error occures when initalization:

SolrCore Initialization Failures

    blog: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException 

Please check your logs for more information

Directory structure in ~/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

Logs:

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 

Could anybody tell me what I'm doing wrong?

1
"Could anybody tell me what I'm doing wrong? - It says ... CLEARLY ... Please check your logs for more information. So what you are doing wrong in the first instant is not reading / paying attention to the error message. If you want someone to help you, you will need to tell us what the log says. Add the log messages to your question.Stephen C
@StephenC I have enclosed logs to this question.user6927987
I didn't say add a link to the Question. I said add the log messages (implicitly the log message that relates to the error message) to the Question. Linking to off-site paste-bins is strongly discouraged. Do it properly if you want my helpStephen C
And ... guess what ... by figuring out which of those log messages relate to the error you showed us, you will have taken a first step towards identifying, diagnosing and fixing the problem. (Hint: I am clearly trying to help you work this out for yourself. These are basic Java 101 troubleshooting techniques. Read the log file, find the stacktrace, read the stacktrace ...)Stephen C
@StephenC I removed link and added log message to question that may relates to question.user6927987

1 Answers

1
votes

OK, so lets look at the stacktrace:

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

Clearly, the cause of the problem is an NPE.

And, it appears to be happening in the conversion of something (parameters) to a SolrParams object.

Clue #1: look at the parameters ....

But which ones? By digging through the source code, etc I can see that:

  1. It is attempting to handle a "ping" request
  2. It is attempting to decode some request parameters with the name "invariants".
  3. There appears to be a parameter with a name but no value ... or something like that. That's the ultimate cause of the NPE.

Here are the source code links:

Look at the specific lines mentioned in the stacktrace.

According to this documentation, the "invariants" are specified as part of the <requestHandler> element in your solrconfig.xml file.

In short, it looks like there is a problem with the solrconfig.xml file. That causes the launcher to send a "ping" to the server with malformed parameters. That causes the server to report the error. The same thing is repeated in the request where it attempts to create the core called "blog".

Solution: Check solrconfig.xml file against what the Solr Documentation says. Fix config problem.

Meta-solution: Learn to read stacktraces and source code. This is the good thing about using open source applications. If something goes wrong, you can read the source code to figure out what caused the problem.