← Back to team overview

dhis2-devs team mailing list archive

[Bug 383462] [NEW] DHIS 1.4 file import fails when there are errors in calculated data elements

 

Public bug reported:

DHIS 1.4 file imports fail silently when there are errors in DHIS 1.4
caclulated data elements. Ideally, this should be solved in DHIS 1.4 by
performing a data integrity check and fixing the errors. However, DHIS 2
should at least abort and rollback the import if such problems occur.
Otherwise, being able to ignore these types of problems, with
acknowledgement from the user would be better. Here is a sample
stacktrace.

* ERROR 11:34:36,112 The process threw exception (ProcessExecutor.java [Thread-20])
java.lang.RuntimeException: Query with RowHandler failed
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:141)
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:124)
	at org.hisp.dhis.importexport.dhis14.file.importer.DefaultDhis14FileImportService.importCalculatedDataElements(DefaultDhis14FileImportService.java:346)
	at org.hisp.dhis.importexport.dhis14.file.importer.DefaultDhis14FileImportService.importData(DefaultDhis14FileImportService.java:257)
	at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(ImportInternalProcess.java:84)
	at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:85)
	at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:37)
	at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:126)
	at java.lang.Thread.run(Thread.java:619)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sqlmap/calculatedDataElement.sqlmap.xml.  
--- The error occurred while applying a result map.  
--- Check the calculatedDataElement.calculatedDataElementResultMap.  
--- The error happened while setting a property on the result object.  
--- Cause: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#48]
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#48]
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithRowHandler(GeneralStatement.java:133)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryWithRowHandler(SqlMapExecutorDelegate.java:644)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryWithRowHandler(SqlMapSessionImpl.java:121)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryWithRowHandler(SqlMapClientImpl.java:98)
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:135)
	... 8 more
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#48]
	at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:590)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:284)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:223)
	at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:33)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
	at org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:564)
	at org.hibernate.impl.SessionImpl.update(SessionImpl.java:552)
	at org.hibernate.impl.SessionImpl.update(SessionImpl.java:544)
	at org.hisp.dhis.dataelement.hibernate.HibernateDataElementStore.updateDataElement(HibernateDataElementStore.java:79)
	at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.hisp.dhis.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:75)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy1.updateDataElement(Unknown Source)
	at org.hisp.dhis.dataelement.DefaultDataElementService.updateDataElement(DefaultDataElementService.java:76)
	at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.hisp.dhis.i18n.interceptor.I18nObjectInterceptor.invoke(I18nObjectInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy2.updateDataElement(Unknown Source)
	at org.hisp.dhis.importexport.converter.AbstractCalculatedDataElementConverter.importMatching(AbstractCalculatedDataElementConverter.java:66)
	at org.hisp.dhis.importexport.converter.AbstractCalculatedDataElementConverter.importMatching(AbstractCalculatedDataElementConverter.java:38)
	at org.hisp.dhis.importexport.converter.AbstractConverter.read(AbstractConverter.java:107)
	at org.hisp.dhis.importexport.dhis14.file.rowhandler.CalculatedDataElementRowHandler.handleRow(CalculatedDataElementRowHandler.java:118)
	at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:76)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:395)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
	... 13 more

** Affects: dhis2
     Importance: Undecided
         Status: New

-- 
DHIS 1.4 file import fails when there are errors in calculated data elements
https://bugs.launchpad.net/bugs/383462
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.

Status in District Health Information Software 2: New

Bug description:
DHIS 1.4 file imports fail silently when there are errors in DHIS 1.4 caclulated data elements. Ideally, this should be solved in DHIS 1.4 by performing a data integrity check and fixing the errors. However, DHIS 2 should at least abort and rollback the import if such problems occur. Otherwise, being able to ignore these types of problems, with acknowledgement from the user would be better. Here is a sample stacktrace. 

* ERROR 11:34:36,112 The process threw exception (ProcessExecutor.java [Thread-20])
java.lang.RuntimeException: Query with RowHandler failed
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:141)
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:124)
	at org.hisp.dhis.importexport.dhis14.file.importer.DefaultDhis14FileImportService.importCalculatedDataElements(DefaultDhis14FileImportService.java:346)
	at org.hisp.dhis.importexport.dhis14.file.importer.DefaultDhis14FileImportService.importData(DefaultDhis14FileImportService.java:257)
	at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(ImportInternalProcess.java:84)
	at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:85)
	at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:37)
	at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:126)
	at java.lang.Thread.run(Thread.java:619)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in sqlmap/calculatedDataElement.sqlmap.xml.  
--- The error occurred while applying a result map.  
--- Check the calculatedDataElement.calculatedDataElementResultMap.  
--- The error happened while setting a property on the result object.  
--- Cause: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#48]
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#48]
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithRowHandler(GeneralStatement.java:133)
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryWithRowHandler(SqlMapExecutorDelegate.java:644)
	at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryWithRowHandler(SqlMapSessionImpl.java:121)
	at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryWithRowHandler(SqlMapClientImpl.java:98)
	at org.hisp.dhis.importexport.dhis14.file.query.IbatisQueryManager.queryWithRowhandler(IbatisQueryManager.java:135)
	... 8 more
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.dataelement.CalculatedDataElement#48]
	at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:590)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:284)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:223)
	at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:33)
	at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
	at org.hibernate.impl.SessionImpl.fireUpdate(SessionImpl.java:564)
	at org.hibernate.impl.SessionImpl.update(SessionImpl.java:552)
	at org.hibernate.impl.SessionImpl.update(SessionImpl.java:544)
	at org.hisp.dhis.dataelement.hibernate.HibernateDataElementStore.updateDataElement(HibernateDataElementStore.java:79)
	at sun.reflect.GeneratedMethodAccessor210.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.hisp.dhis.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:75)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy1.updateDataElement(Unknown Source)
	at org.hisp.dhis.dataelement.DefaultDataElementService.updateDataElement(DefaultDataElementService.java:76)
	at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.hisp.dhis.i18n.interceptor.I18nObjectInterceptor.invoke(I18nObjectInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy2.updateDataElement(Unknown Source)
	at org.hisp.dhis.importexport.converter.AbstractCalculatedDataElementConverter.importMatching(AbstractCalculatedDataElementConverter.java:66)
	at org.hisp.dhis.importexport.converter.AbstractCalculatedDataElementConverter.importMatching(AbstractCalculatedDataElementConverter.java:38)
	at org.hisp.dhis.importexport.converter.AbstractConverter.read(AbstractConverter.java:107)
	at org.hisp.dhis.importexport.dhis14.file.rowhandler.CalculatedDataElementRowHandler.handleRow(CalculatedDataElementRowHandler.java:118)
	at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java:76)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:395)
	at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:185)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
	at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
	... 13 more



Follow ups

References