Issue 17308

DwcaMetasyncService fails to write EML for CoL constituent

17308
Reporter: mdoering
Assignee: mdoering
Type: Bug
Summary: DwcaMetasyncService fails to write EML for CoL constituent
Priority: Blocker
Resolution: Fixed
Status: Closed
Created: 2015-02-23 17:59:38.258
Updated: 2015-02-25 17:45:16.791
Resolved: 2015-02-25 17:45:16.768
        
Description: Not only does the slightly invalid EML not make it into our registry, the metasyncing for the remaining constituents also does not happen. We need to catch these exceptions!

-----

INFO  [2015-02-23 15:26:22,009+0100] [pool-9-thread-3] org.gbif.crawler.dwca.metasync.DwcaMetasyncService: Created new constituent 35 with key 241f9e56-30e7-440d-bba1-ebd40c7f5e3c for dataset 7ddf754f-d193-4cc9-b351-99906754a03b
ERROR [2015-02-23 15:26:22,200+0100] [pool-9-thread-3] org.gbif.crawler.dwca.metasync.DwcaMetasyncService: Exception caught during metasyncing DwC-A [7ddf754f-d193-4cc9-b351-99906754a03b]
org.gbif.api.exception.ServiceUnavailableException: An internal server error occurred, please try again later.
	at org.gbif.ws.client.interceptor.HttpErrorResponseInterceptor.invoke(HttpErrorResponseInterceptor.java:76) ~[crawler-cli.jar:na]
	at org.gbif.crawler.dwca.metasync.DwcaMetasyncService$DwcaValidationFinishedMessageCallback.setMetaDocument(DwcaMetasyncService.java:192) [crawler-cli.jar:na]
	at org.gbif.crawler.dwca.metasync.DwcaMetasyncService$DwcaValidationFinishedMessageCallback.addNewConstituent(DwcaMetasyncService.java:232) [crawler-cli.jar:na]
	at org.gbif.crawler.dwca.metasync.DwcaMetasyncService$DwcaValidationFinishedMessageCallback.processConstituents(DwcaMetasyncService.java:182) [crawler-cli.jar:na]
	at org.gbif.crawler.dwca.metasync.DwcaMetasyncService$DwcaValidationFinishedMessageCallback.handleMessageInternal(DwcaMetasyncService.java:126) [crawler-cli.jar:na]
	at org.gbif.crawler.dwca.metasync.DwcaMetasyncService$DwcaValidationFinishedMessageCallback.handleMessage(DwcaMetasyncService.java:95) [crawler-cli.jar:na]
	at org.gbif.crawler.dwca.metasync.DwcaMetasyncService$DwcaValidationFinishedMessageCallback.handleMessage(DwcaMetasyncService.java:65) [crawler-cli.jar:na]
	at org.gbif.common.messaging.MessageConsumer.handleCallback(MessageConsumer.java:101) [crawler-cli.jar:na]
	at org.gbif.common.messaging.MessageConsumer.handleDelivery(MessageConsumer.java:65) [crawler-cli.jar:na]
	at com.rabbitmq.client.impl.ConsumerDispatcher$4.run(ConsumerDispatcher.java:121) [crawler-cli.jar:na]
	at com.rabbitmq.client.impl.ConsumerWorkService$WorkPoolRunnable.run(ConsumerWorkService.java:76) [crawler-cli.jar:na]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_75]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_75]
	at java.lang.Thread.run(Thread.java:745) [na:1.7.0_75]
Caused by: com.sun.jersey.api.client.UniformInterfaceException: HTTP 500: 


Error 500 Server Error

HTTP ERROR 500

Problem accessing /dataset/241f9e56-30e7-440d-bba1-ebd40c7f5e3c/document. Reason:

    Server Error

Caused by:

org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_first_name_check"
  Detail: Failing row contains (79444, , Land J. van der (ed) (?), null, null, null, null, null, null, crawler.gbif.org, crawler.gbif.org, 2015-02-23 15:26:22.166387+01, 2015-02-23 15:26:22.166387+01, 'der':4 'ed':5 'j':2 'land':1 'van':3 '?':6, {}, {}, {}, {}, {}, {}).
### The error may involve org.gbif.registry.persistence.mapper.ContactMapper.createContact-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO contact(      user_id,first_name,last_name,description,position,email,phone,homepage,organization,address,city,province,country,postal_code,created,created_by,modified,modified_by    )     VALUES(      ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     now(),      ?,     now(),      ?    )
### Cause: org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_first_name_check"
  Detail: Failing row contains (79444, , Land J. van der (ed) (?), null, null, null, null, null, null, crawler.gbif.org, crawler.gbif.org, 2015-02-23 15:26:22.166387+01, 2015-02-23 15:26:22.166387+01, 'der':4 'ed':5 'j':2 'land':1 'van':3 '?':6, {}, {}, {}, {}, {}, {}).
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:141)
	at sun.reflect.GeneratedMethodAccessor802.invoke(Unknown Source)
]]>
    


Author: mdoering@gbif.org
Created: 2015-02-25 17:38:50.53
Updated: 2015-02-25 17:39:07.222
        
This non empty string check also happens for the contact last names:
-----

Problem accessing /dataset/71cfcf5c-f762-11e1-a439-00145eb45e9a/document. Reason:

    Server Error

Caused by:

org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_last_name_check"
  Detail: Failing row contains (80243, null, , null, null, null, null, null, null, markus, markus, 2015-02-25 17:33:43.557545+01, 2015-02-25 17:33:43.557545+01, , {}, {}, {}, {}, {}, {}).
### The error may involve org.gbif.registry.persistence.mapper.ContactMapper.createContact-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO contact(      user_id,first_name,last_name,description,position,email,phone,homepage,organization,address,city,province,country,postal_code,created,created_by,modified,modified_by    )     VALUES(      ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     now(),      ?,     now(),      ?    )
### Cause: org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_last_name_check"
  Detail: Failing row contains (80243, null, , null, null, null, null, null, null, markus, markus, 2015-02-25 17:33:43.557545+01, 2015-02-25 17:33:43.557545+01, , {}, {}, {}, {}, {}, {}).
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:154)
-----

Caused by:

org.postgresql.util.PSQLException: ERROR: new row for relation "contact" violates check constraint "contact_last_name_check"
  Detail: Failing row contains (80243, null, , null, null, null, null, null, null, markus, markus, 2015-02-25 17:33:43.557545+01, 2015-02-25 17:33:43.557545+01, , {}, {}, {}, {}, {}, {}).
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

    


Author: mdoering@gbif.org
Created: 2015-02-25 17:43:43.883
Updated: 2015-02-25 17:43:43.883
        
Seems to be the same as the already fixed POR-2657
Production still runs on 2.24 release so it lacks this fix