Issue 16792

Checklistbank index builder NPE

16792
Reporter: mdoering
Assignee: mdoering
Type: Bug
Summary: Checklistbank index builder NPE
Priority: Critical
Resolution: Fixed
Status: Resolved
Created: 2015-01-22 15:19:25.188
Updated: 2015-02-02 14:52:27.718
Resolved: 2015-02-02 14:52:27.694
        
Description: When rebuilding a new, complete clb solr index the DocConverter sometimes fails with an NPE in the logs:

-----
ERROR [2015-01-22 06:37:05,744+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 109584200 to solr document: null
ERROR [2015-01-22 06:37:05,745+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 109584200
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:105) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:22) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-22 06:37:05,745+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 109584201 to solr document: null
ERROR [2015-01-22 06:37:05,745+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 109584201
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:105) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:22) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-22 06:37:05,745+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 109584202 to solr document: null
ERROR [2015-01-22 06:37:05,746+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 109584202
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:105) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:22) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-22 06:37:05,746+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 109584203 to solr document: null
ERROR [2015-01-22 06:37:05,746+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 109584203
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:105) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:22) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-22 06:37:05,746+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 109584204 to solr document: null
ERROR [2015-01-22 06:37:05,746+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 109584204
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:105) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:22) [checklistbank-solr.jar:2.10-SNAPSHOT]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-22 06:37:05,747+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 109584205 to solr document: null
ERROR [2015-01-22 06:37:05,747+0100] [pool-1-thread-3] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 109584205
]]>
    


Author: mdoering@gbif.org
Created: 2015-01-22 20:14:02.806
Updated: 2015-01-22 20:14:02.806
        
Happens when speceis profile record properties are all null.
Fixed in https://github.com/gbif/checklistbank/commit/83e9cbedc3526622f011f73806f48cb44b8a8d9f
    


Author: mdoering@gbif.org
Created: 2015-01-24 09:48:31.741
Updated: 2015-01-24 09:48:31.741
        
Unfortunstely this also happens for other extension classes than SpeciesInfo.
Distribution:
----------
ERROR [2015-01-24 06:20:31,320+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 110448017 to solr document: java.lang.Integer cannot be cast to org.gbif.a
pi.model.checklistbank.Distribution
ERROR [2015-01-24 06:20:31,412+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 110448017
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution
        at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:110) [checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:27) [checklistbank-solr.jar:2.10]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution
        at org.gbif.checklistbank.index.NameUsageDocConverter.addDistributionsAndThreatStatus(NameUsageDocConverter.java:171) ~[checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:115) ~[checklistbank-solr.jar:2.10]
        ... 8 common frames omitted
ERROR [2015-01-24 06:20:31,413+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 110448019 to solr document: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution
ERROR [2015-01-24 06:20:31,413+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 110448019
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution
        at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:110) [checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:27) [checklistbank-solr.jar:2.10]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution
        at org.gbif.checklistbank.index.NameUsageDocConverter.addDistributionsAndThreatStatus(NameUsageDocConverter.java:171) ~[checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:115) ~[checklistbank-solr.jar:2.10]
        ... 8 common frames omitted
ERROR [2015-01-24 06:20:31,545+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 110448042 to solr document: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution
ERROR [2015-01-24 06:20:31,545+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 110448042
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to org.gbif.api.model.checklistbank.Distribution

----------

UNKNOWN cast error:
ERROR [2015-01-24 06:22:14,975+0100] [pool-1-thread-2] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 110442779 to solr document: null
ERROR [2015-01-24 06:22:14,976+0100] [pool-1-thread-2] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 110442779
java.lang.RuntimeException: java.lang.ClassCastException
        at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:110) [checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:27) [checklistbank-solr.jar:2.10]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-24 06:22:15,072+0100] [pool-1-thread-2] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 110442855 to solr document: null
ERROR [2015-01-24 06:22:15,072+0100] [pool-1-thread-2] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 110442855
java.lang.RuntimeException: java.lang.ClassCastException
        at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:110) [checklistbank-solr.jar:2.10]
        at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:27) [checklistbank-solr.jar:2.10]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
        at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.ClassCastException: null
ERROR [2015-01-24 06:22:15,103+0100] [pool-1-thread-2] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 110442871 to solr document: null
ERROR [2015-01-24 06:22:15,103+0100] [pool-1-thread-2] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 110442871

    


Author: mdoering@gbif.org
Created: 2015-02-02 11:52:46.033
Updated: 2015-02-02 11:52:46.033
        
more on production:

ERROR [2015-02-02 11:51:12,976+0100] [pool-1-thread-9] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 114989965
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:110) [checklistbank-solr.jar:2.10]
	at org.gbif.checklistbank.index.NameUsageIndexingJob.call(NameUsageIndexingJob.java:27) [checklistbank-solr.jar:2.10]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_71]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_71]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71]
Caused by: java.lang.ClassCastException: null
INFO  [2015-02-02 11:51:13,829+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageIndexingJob: Finished indexing of usages in range 111417356-111427355. Total time: 0:00:37.799
INFO  [2015-02-02 11:51:13,829+0100] [pool-1-thread-7] org.gbif.checklistbank.index.NameUsageIndexingJob: Adding usages from id 115059838 to 115069837
ERROR [2015-02-02 11:51:15,794+0100] [pool-1-thread-9] org.gbif.checklistbank.index.NameUsageDocConverter: Error converting usage 114989976 to solr document: null
ERROR [2015-02-02 11:51:15,795+0100] [pool-1-thread-9] org.gbif.checklistbank.index.NameUsageIndexingJob: Error indexing document for usage 114989976
java.lang.RuntimeException: java.lang.ClassCastException
	at org.gbif.checklistbank.index.NameUsageDocConverter.toObject(NameUsageDocConverter.java:127) ~[checklistbank-solr.jar:2.10]

    


Author: mdoering@gbif.org
Comment: https://github.com/gbif/checklistbank/commit/a95a5d2f44811f9292d2c20a17abce870bb8c6b6
Created: 2015-02-02 14:52:27.716
Updated: 2015-02-02 14:52:27.716