Reply
Highlighted
New Contributor
Posts: 5
Registered: ‎08-08-2018
Accepted Solution

Solr - java.lang.NullPointerException : createMainQuery

I am using CDH 15.5, which comes with Solr 4.10

 

I ran into issues indexing a csv document, in the schema config i had specified a uniqueKey value, for some reason it kept giving me a "org.apache.solr.common.SolrException: Document contains multiple values for uniqueKey field: id" -- I've asked about this in a separate thread.

So i removed the uniqueKey constraint in the configurations, then i ran into another error -- "QueryElevationComponent requires the schema to have a uniqueKeyField" , this means uniqueKey definition is enforced in the solrconfig.xml file. I subsequently disabled this from the Solrconfig.xml, and was able to successfully index the file.

 

However when i try to query from the Solr admin using the Select handler, i get an exception below.

A quick glance through the stacktrace shows that the null exception is returned in the createMainQuery method.

 

https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/handler/compone...

 

String keyFieldName = rb.req.getSchema().getUniqueKeyField().getName();

 

In the method definition of CreateMainQuery, there's an attemp to assign a certain variable the uniqueKeyField, which if not enabled means its null, hence the null exception.

 

 

 

StackTrace:

 

java.lang.NullPointerException
	at org.apache.solr.handler.component.QueryComponent.createMainQuery(QueryComponent.java:800)
	at org.apache.solr.handler.component.QueryComponent.regularDistributedProcess(QueryComponent.java:679)
	at org.apache.solr.handler.component.QueryComponent.distributedProcess(QueryComponent.java:632)
	at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:255)
	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
	at org.apache.solr.core.SolrCore.execute(SolrCore.java:2259)
	at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:923)
	at org.apache.solr.servlet.SolrDispatchFilter.httpSolrCall(SolrDispatchFilter.java:484)
	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:254)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.solr.servlet.SolrHadoopAuthenticationFilter$2.doFilter(SolrHadoopAuthenticationFilter.java:408)
	at org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:631)
	at org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter.doFilter(DelegationTokenAuthenticationFilter.java:301)
	at org.apache.hadoop.security.authentication.server.AuthenticationFilter.doFilter(AuthenticationFilter.java:579)
	at org.apache.solr.servlet.SolrHadoopAuthenticationFilter.doFilter(SolrHadoopAuthenticationFilter.java:413)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:610)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
	at java.lang.Thread.run(Thread.java:745)

Can anyone confirm they've ran into this issue with CDH 15.5

 

 

 

 

 

New Contributor
Posts: 5
Registered: ‎08-08-2018

Re: Solr - java.lang.NullPointerException : createMainQuery

curl -v "http://localhost:8983/solr/collection3/update/csv?header=true&stream.file=/home/data1/books.csv&stream.contentType=text/csv;charset=utf-8"

 

Successfuly indexes, with no uniqueID specified in the schema.xml, but on querying a null exception is returned

 

When i added the uniqueKey back in the schema.xml and re-enabled the QueryElevationComponent and then re-indexed, i was able to query with no issues.

 

So i've come to a conculusion that a uniqueKey is a requirement in the schema.xml definition

 

 

 

 

Announcements