You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by srinalluri <na...@yahoo.com> on 2013/04/29 18:40:47 UTC

java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

I am in Solr 3.6.1. 
The following entity gives java.lang.NullPointerException. How to debug
this? Here I am usingCachedSqlEntityProcessor. 

<entity name="vig8-article-mon" dataSource="vig8" pk="VCMID" 
    preImportDeleteQuery="content_type:article AND repository:vig8qamon" 
    query="select ID as VCMID from tab_story2">
      <entity name="recordid" dataSource="vig8"
transformer="TemplateTransformer"
      query="select RECORDID from vgnasmomap where keystring1 =
'${vig8-article-mon.VCMID}'">
        <field column="content_type" template="article" />
        <field column="RECORDID" name="native_id" />
        <field column="repository" template="vig8qamon" />
      </entity>
      <entity name="article_details" dataSource="vig8"
transformer="ClobTransformer,RegexTransformer"
      query="select STORY_TITLE, STORY_HEADLINE, SOURCE, DECK,
regexp_replace(body, '\&lt;p\&gt;\[(pullquote|summary)\]\&lt;/p\&gt;|\[video
[0-9]+?\]|\[youtube .+?\]', '') as BODY, PUBLISHED_DATE, MODIFIED_DATE,
DATELINE, REPORTER_NAME, TICKER_CODES,ADVERTORIAL_CONTENT from tab_story2"
processor="CachedSqlEntityProcessor" where="id=vig8-article-mon.VCMID" >
        <field column="STORY_TITLE" name="title" />
        <field column="DECK" name="description" clob="true" />
        <field column="PUBLISHED_DATE" name="date" />
        <field column="MODIFIED_DATE" name="last_modified_date" />
        <field column="BODY" name="body" clob="true" />
        <field column="SOURCE" name="source" />
        <field column="DATELINE" name="dateline" />
        <field column="STORY_HEADLINE" name="export_headline" />        
      </entity>
      </entity>

Here is the exception message:


SEVERE: Exception while processing: vig8-article-mon document :
SolrInputDocument[{repository=repository(1.0)={vig8qamon},
native_id=native_id(1.0)={8f2210474fea2310VgnVCM100000d1c1a8c0RCRD},
content_type=content_type(1.0)={article}}]:org.apache.solr.handler.dataimport.DataImportHandlerException:
java.lang.NullPointerException
        at
org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:64)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:333)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:296)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:683)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:709)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:619)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:327)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:225)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:375)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:445)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:426)
Caused by: java.lang.NullPointerException
        at java.util.TreeMap.getEntry(TreeMap.java:342)
        at java.util.TreeMap.get(TreeMap.java:273)
        at
org.apache.solr.handler.dataimport.SortedMapBackedCache.add(SortedMapBackedCache.java:57)
        at
org.apache.solr.handler.dataimport.DIHCacheSupport.populateCache(DIHCacheSupport.java:124)
        at
org.apache.solr.handler.dataimport.DIHCacheSupport.getIdCacheData(DIHCacheSupport.java:176)
        at
org.apache.solr.handler.dataimport.DIHCacheSupport.getCacheData(DIHCacheSupport.java:145)
        at
org.apache.solr.handler.dataimport.EntityProcessorBase.getNext(EntityProcessorBase.java:132)
        at
org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:75)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:330)




--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-NullPointerException-I-am-trying-to-use-CachedSqlEntityProcessor-tp4059815.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

Posted by srinalluri <na...@yahoo.com>.
I have solved this problem and able work with CachedSqlEntityProcessor
successfully after a very long struggle. 

I tried this on 4.2.

There are still existing bugs it seems:
1. What ever you mention in cacheKey, that field name must in the select
statement explicitly.
2. If I am correct, the field name in cacheKey and in the select statement
are case sensitive.
3. We have ID field in our table, I tried to give cacheKey="ID". But that
got conflicted with the uniqueKey as uniqueKey is also "ID". So I wrote it
as "SELECT ID AS AID,....." and cacheKey="AID"

thanks
Srini  




--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-NullPointerException-I-am-trying-to-use-CachedSqlEntityProcessor-tp4059815p4070059.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
If I remember correctly, 3.6 DIH had bugs related to CachedSqlEntityProcessor and some were fixed in 3.6.1, 3.6.2, but some were not fixed until 4.0.  You might want to use a 3.5 DIH jar with your 3.6 Solr.  Or, post your data-config.xml and maybe someone can figure something out.

James Dyer
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: srinalluri [mailto:nallurisrini@yahoo.com] 
Sent: Tuesday, April 30, 2013 10:53 AM
To: solr-user@lucene.apache.org
Subject: RE: java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

Thanks James for your reply.

I have updated to 3.6.2. Now the NullPointerException is gone. But the
entities with CachedSqlEntityProcessor don't add anything to solr.

And entities without CachedSqlEntityProcessor, are working fine.

Why entities with CachedSqlEntityProcessor don't do anything? What is wrong
in my entity?



--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-NullPointerException-I-am-trying-to-use-CachedSqlEntityProcessor-tp4059815p4060043.html
Sent from the Solr - User mailing list archive at Nabble.com.



RE: java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

Posted by srinalluri <na...@yahoo.com>.
Thanks James for your reply.

I have updated to 3.6.2. Now the NullPointerException is gone. But the
entities with CachedSqlEntityProcessor don't add anything to solr.

And entities without CachedSqlEntityProcessor, are working fine.

Why entities with CachedSqlEntityProcessor don't do anything? What is wrong
in my entity?



--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-NullPointerException-I-am-trying-to-use-CachedSqlEntityProcessor-tp4059815p4060043.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
This sounds like https://issues.apache.org/jira/browse/SOLR-3791, which was resolved in 3.6.2 / 4.0.

James Dyer
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: srinalluri [mailto:nallurisrini@yahoo.com] 
Sent: Monday, April 29, 2013 11:41 AM
To: solr-user@lucene.apache.org
Subject: java.lang.NullPointerException. I am trying to use CachedSqlEntityProcessor

I am in Solr 3.6.1. 
The following entity gives java.lang.NullPointerException. How to debug
this? Here I am usingCachedSqlEntityProcessor. 

<entity name="vig8-article-mon" dataSource="vig8" pk="VCMID" 
    preImportDeleteQuery="content_type:article AND repository:vig8qamon" 
    query="select ID as VCMID from tab_story2">
      <entity name="recordid" dataSource="vig8"
transformer="TemplateTransformer"
      query="select RECORDID from vgnasmomap where keystring1 =
'${vig8-article-mon.VCMID}'">
        <field column="content_type" template="article" />
        <field column="RECORDID" name="native_id" />
        <field column="repository" template="vig8qamon" />
      </entity>
      <entity name="article_details" dataSource="vig8"
transformer="ClobTransformer,RegexTransformer"
      query="select STORY_TITLE, STORY_HEADLINE, SOURCE, DECK,
regexp_replace(body, '\&lt;p\&gt;\[(pullquote|summary)\]\&lt;/p\&gt;|\[video
[0-9]+?\]|\[youtube .+?\]', '') as BODY, PUBLISHED_DATE, MODIFIED_DATE,
DATELINE, REPORTER_NAME, TICKER_CODES,ADVERTORIAL_CONTENT from tab_story2"
processor="CachedSqlEntityProcessor" where="id=vig8-article-mon.VCMID" >
        <field column="STORY_TITLE" name="title" />
        <field column="DECK" name="description" clob="true" />
        <field column="PUBLISHED_DATE" name="date" />
        <field column="MODIFIED_DATE" name="last_modified_date" />
        <field column="BODY" name="body" clob="true" />
        <field column="SOURCE" name="source" />
        <field column="DATELINE" name="dateline" />
        <field column="STORY_HEADLINE" name="export_headline" />        
      </entity>
      </entity>

Here is the exception message:


SEVERE: Exception while processing: vig8-article-mon document :
SolrInputDocument[{repository=repository(1.0)={vig8qamon},
native_id=native_id(1.0)={8f2210474fea2310VgnVCM100000d1c1a8c0RCRD},
content_type=content_type(1.0)={article}}]:org.apache.solr.handler.dataimport.DataImportHandlerException:
java.lang.NullPointerException
        at
org.apache.solr.handler.dataimport.DataImportHandlerException.wrapAndThrow(DataImportHandlerException.java:64)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:333)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:296)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:683)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:709)
        at
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:619)
        at
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:327)
        at
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:225)
        at
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:375)
        at
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:445)
        at
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:426)
Caused by: java.lang.NullPointerException
        at java.util.TreeMap.getEntry(TreeMap.java:342)
        at java.util.TreeMap.get(TreeMap.java:273)
        at
org.apache.solr.handler.dataimport.SortedMapBackedCache.add(SortedMapBackedCache.java:57)
        at
org.apache.solr.handler.dataimport.DIHCacheSupport.populateCache(DIHCacheSupport.java:124)
        at
org.apache.solr.handler.dataimport.DIHCacheSupport.getIdCacheData(DIHCacheSupport.java:176)
        at
org.apache.solr.handler.dataimport.DIHCacheSupport.getCacheData(DIHCacheSupport.java:145)
        at
org.apache.solr.handler.dataimport.EntityProcessorBase.getNext(EntityProcessorBase.java:132)
        at
org.apache.solr.handler.dataimport.SqlEntityProcessor.nextRow(SqlEntityProcessor.java:75)
        at
org.apache.solr.handler.dataimport.EntityProcessorWrapper.pullRow(EntityProcessorWrapper.java:330)




--
View this message in context: http://lucene.472066.n3.nabble.com/java-lang-NullPointerException-I-am-trying-to-use-CachedSqlEntityProcessor-tp4059815.html
Sent from the Solr - User mailing list archive at Nabble.com.