tjake/Solandra

NPE on doc add through solrj

wwwill opened this issue · 1 comments

I run this solrj code:

SolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solandra");
Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", "1", 1.0f);
doc.addField("text", "this is some text for search", 10);
doc.addField("start", "20120220080000", 10);
doc.addField("end", "20120220081000", 10);
docs.add(doc);
server.add(docs);
server.commit();

and, I see this exception:

INFO 15:20:38,789 [] webapp=/solandra path=/update params={wt=javabin&version=2} status=500 QTime=1
ERROR 15:20:38,798 java.lang.NullPointerException
at solandra.SolandraIndexWriter.addDoc(SolandraIndexWriter.java:241)
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:61)
at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:115)
at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:158)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:79)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:67)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1368)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
at solandra.SolandraDispatchFilter.execute(SolandraDispatchFilter.java:171)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
at solandra.SolandraDispatchFilter.doFilter(SolandraDispatchFilter.java:137)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:843)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

In SolandraIndexWriter line 241, either SolandraCoreInfo is null or AddUpdateCommand is null.

Any ideas why this might be happening?

It seems like it could be related to open issue #129.

Thanks,
-Will

I was not giving it a specific core. After I pushed a schema (and created a named core) and then connected to that with

SolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solandra/myschema");

everything started to work. No more NPEs and adding/querying index work now. I followed the example of the reuters demo.