[DHIS] Unable to delete a user

Hi Morten,

We are using DHIS version 2.23 and created some sample metadata on it. When we try to delete a user, the user does not get removed.

Following are the logs for the exception:

  • INFO 2016-03-04 16:13:13,146 ‘admin’ update org.hisp.dhis.user.UserAuthorityGroup, name: Superuser, uid: gETZb5SDObu (AuditLogUtil.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,151 Failed to invoke method deleteUser on DeletionHandler ‘UserSettingDeletionHandler’ (DefaultDeletionManager.java [qtp1727373358-105])

java.lang.reflect.InvocationTargetException

at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.hisp.dhis.system.deletion.DefaultDeletionManager.execute(DefaultDeletionManager.java:147)

at org.hisp.dhis.system.deletion.DeletionInterceptor.intercept(DeletionInterceptor.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.user.UserSetting#org.hisp.dhis.user.UserSetting@528fc6ba]

at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:696)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:119)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:918)

at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855)

at org.hisp.dhis.user.hibernate.HibernateUserSettingStore.deleteUserSetting(HibernateUserSettingStore.java:107)

at org.hisp.dhis.user.DefaultUserSettingService.deleteUserSetting(DefaultUserSettingService.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  • INFO 2016-03-04 16:13:13,154 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])

  • INFO 2016-03-04 16:13:13,155 ‘admin’ delete org.hisp.dhis.user.UserCredentials, name: admin admin (AuditLogUtil.java [qtp1727373358-105])

  • INFO 2016-03-04 16:13:13,158 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])

  • WARN 2016-03-04 16:13:13,174 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”. (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 Error while executing action (ExceptionInterceptor.java [qtp1727373358-105])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_usersetting_userinfoid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

Could you please help fix this.

Regards,

···

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

Hi Archana,

I think this happens due to some leak in our application cache. Try going to data admin > cache statistics > clear cache and try again.

regards,

Lars

···

On Fri, Mar 4, 2016 at 11:52 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We are using DHIS version 2.23 and created some sample metadata on it. When we try to delete a user, the user does not get removed.

Following are the logs for the exception:

  • INFO 2016-03-04 16:13:13,146 ‘admin’ update org.hisp.dhis.user.UserAuthorityGroup, name: Superuser, uid: gETZb5SDObu (AuditLogUtil.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,151 Failed to invoke method deleteUser on DeletionHandler ‘UserSettingDeletionHandler’ (DefaultDeletionManager.java [qtp1727373358-105])

java.lang.reflect.InvocationTargetException

at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.hisp.dhis.system.deletion.DefaultDeletionManager.execute(DefaultDeletionManager.java:147)

at org.hisp.dhis.system.deletion.DeletionInterceptor.intercept(DeletionInterceptor.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.user.UserSetting#org.hisp.dhis.user.UserSetting@528fc6ba]

at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:696)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:119)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:918)

at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855)

at org.hisp.dhis.user.hibernate.HibernateUserSettingStore.deleteUserSetting(HibernateUserSettingStore.java:107)

at org.hisp.dhis.user.DefaultUserSettingService.deleteUserSetting(DefaultUserSettingService.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  • INFO 2016-03-04 16:13:13,154 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,155 ‘admin’ delete org.hisp.dhis.user.UserCredentials, name: admin admin (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,158 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • WARN 2016-03-04 16:13:13,174 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,175 ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”. (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 Error while executing action (ExceptionInterceptor.java [qtp1727373358-105])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_usersetting_userinfoid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

Could you please help fix this.

Regards,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Hi Lars,

I tried clear cache. But still the same. Unable to delete a user. Even if the user is newly created and not associated to any other object.

Any thoughts on this?

Thanks

···

On Wed, Mar 9, 2016 at 6:22 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Archana,

I think this happens due to some leak in our application cache. Try going to data admin > cache statistics > clear cache and try again.

regards,

Lars

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Fri, Mar 4, 2016 at 11:52 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We are using DHIS version 2.23 and created some sample metadata on it. When we try to delete a user, the user does not get removed.

Following are the logs for the exception:

  • INFO 2016-03-04 16:13:13,146 ‘admin’ update org.hisp.dhis.user.UserAuthorityGroup, name: Superuser, uid: gETZb5SDObu (AuditLogUtil.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,151 Failed to invoke method deleteUser on DeletionHandler ‘UserSettingDeletionHandler’ (DefaultDeletionManager.java [qtp1727373358-105])

java.lang.reflect.InvocationTargetException

at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.hisp.dhis.system.deletion.DefaultDeletionManager.execute(DefaultDeletionManager.java:147)

at org.hisp.dhis.system.deletion.DeletionInterceptor.intercept(DeletionInterceptor.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.user.UserSetting#org.hisp.dhis.user.UserSetting@528fc6ba]

at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:696)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:119)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:918)

at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855)

at org.hisp.dhis.user.hibernate.HibernateUserSettingStore.deleteUserSetting(HibernateUserSettingStore.java:107)

at org.hisp.dhis.user.DefaultUserSettingService.deleteUserSetting(DefaultUserSettingService.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  • INFO 2016-03-04 16:13:13,154 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,155 ‘admin’ delete org.hisp.dhis.user.UserCredentials, name: admin admin (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,158 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • WARN 2016-03-04 16:13:13,174 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,175 ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”. (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 Error while executing action (ExceptionInterceptor.java [qtp1727373358-105])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_usersetting_userinfoid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

Could you please help fix this.

Regards,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Dear all,

This is not really new, from I can delete a user without any problem as long as I am admin but in a life instance you can only disable users.

Regards,

Gerald

···

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Wed, Mar 9, 2016 at 6:22 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Archana,

I think this happens due to some leak in our application cache. Try going to data admin > cache statistics > clear cache and try again.

regards,

Lars

On Fri, Mar 4, 2016 at 11:52 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We are using DHIS version 2.23 and created some sample metadata on it. When we try to delete a user, the user does not get removed.

Following are the logs for the exception:

  • INFO 2016-03-04 16:13:13,146 ‘admin’ update org.hisp.dhis.user.UserAuthorityGroup, name: Superuser, uid: gETZb5SDObu (AuditLogUtil.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,151 Failed to invoke method deleteUser on DeletionHandler ‘UserSettingDeletionHandler’ (DefaultDeletionManager.java [qtp1727373358-105])

java.lang.reflect.InvocationTargetException

at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.hisp.dhis.system.deletion.DefaultDeletionManager.execute(DefaultDeletionManager.java:147)

at org.hisp.dhis.system.deletion.DeletionInterceptor.intercept(DeletionInterceptor.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.user.UserSetting#org.hisp.dhis.user.UserSetting@528fc6ba]

at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:696)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:119)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:918)

at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855)

at org.hisp.dhis.user.hibernate.HibernateUserSettingStore.deleteUserSetting(HibernateUserSettingStore.java:107)

at org.hisp.dhis.user.DefaultUserSettingService.deleteUserSetting(DefaultUserSettingService.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  • INFO 2016-03-04 16:13:13,154 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,155 ‘admin’ delete org.hisp.dhis.user.UserCredentials, name: admin admin (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,158 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • WARN 2016-03-04 16:13:13,174 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,175 ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”. (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 Error while executing action (ExceptionInterceptor.java [qtp1727373358-105])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_usersetting_userinfoid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

Could you please help fix this.

Regards,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Hi Archana,

this has been fixed in trunk now.

This does not affect stable releases.

regards,

Lars

···

On Fri, Mar 11, 2016 at 6:44 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Lars,

I tried clear cache. But still the same. Unable to delete a user. Even if the user is newly created and not associated to any other object.

Any thoughts on this?

Thanks

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Wed, Mar 9, 2016 at 6:22 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Archana,

I think this happens due to some leak in our application cache. Try going to data admin > cache statistics > clear cache and try again.

regards,

Lars

On Fri, Mar 4, 2016 at 11:52 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We are using DHIS version 2.23 and created some sample metadata on it. When we try to delete a user, the user does not get removed.

Following are the logs for the exception:

  • INFO 2016-03-04 16:13:13,146 ‘admin’ update org.hisp.dhis.user.UserAuthorityGroup, name: Superuser, uid: gETZb5SDObu (AuditLogUtil.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,151 Failed to invoke method deleteUser on DeletionHandler ‘UserSettingDeletionHandler’ (DefaultDeletionManager.java [qtp1727373358-105])

java.lang.reflect.InvocationTargetException

at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.hisp.dhis.system.deletion.DefaultDeletionManager.execute(DefaultDeletionManager.java:147)

at org.hisp.dhis.system.deletion.DeletionInterceptor.intercept(DeletionInterceptor.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.user.UserSetting#org.hisp.dhis.user.UserSetting@528fc6ba]

at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:696)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:119)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:918)

at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855)

at org.hisp.dhis.user.hibernate.HibernateUserSettingStore.deleteUserSetting(HibernateUserSettingStore.java:107)

at org.hisp.dhis.user.DefaultUserSettingService.deleteUserSetting(DefaultUserSettingService.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  • INFO 2016-03-04 16:13:13,154 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,155 ‘admin’ delete org.hisp.dhis.user.UserCredentials, name: admin admin (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,158 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • WARN 2016-03-04 16:13:13,174 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,175 ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”. (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 Error while executing action (ExceptionInterceptor.java [qtp1727373358-105])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_usersetting_userinfoid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

Could you please help fix this.

Regards,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Thanks, Lars.

···

On Sun, Mar 13, 2016 at 7:57 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Archana,

this has been fixed in trunk now.

This does not affect stable releases.

regards,

Lars

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Fri, Mar 11, 2016 at 6:44 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Lars,

I tried clear cache. But still the same. Unable to delete a user. Even if the user is newly created and not associated to any other object.

Any thoughts on this?

Thanks


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks

On Wed, Mar 9, 2016 at 6:22 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Archana,

I think this happens due to some leak in our application cache. Try going to data admin > cache statistics > clear cache and try again.

regards,

Lars

On Fri, Mar 4, 2016 at 11:52 AM, Archana Chillala archanac@thoughtworks.com wrote:

Hi Morten,

We are using DHIS version 2.23 and created some sample metadata on it. When we try to delete a user, the user does not get removed.

Following are the logs for the exception:

  • INFO 2016-03-04 16:13:13,146 ‘admin’ update org.hisp.dhis.user.UserAuthorityGroup, name: Superuser, uid: gETZb5SDObu (AuditLogUtil.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,151 Failed to invoke method deleteUser on DeletionHandler ‘UserSettingDeletionHandler’ (DefaultDeletionManager.java [qtp1727373358-105])

java.lang.reflect.InvocationTargetException

at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.hisp.dhis.system.deletion.DefaultDeletionManager.execute(DefaultDeletionManager.java:147)

at org.hisp.dhis.system.deletion.DeletionInterceptor.intercept(DeletionInterceptor.java:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.hisp.dhis.user.UserSetting#org.hisp.dhis.user.UserSetting@528fc6ba]

at org.hibernate.engine.internal.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:696)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:119)

at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:74)

at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:918)

at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:855)

at org.hisp.dhis.user.hibernate.HibernateUserSettingStore.deleteUserSetting(HibernateUserSettingStore.java:107)

at org.hisp.dhis.user.DefaultUserSettingService.deleteUserSetting(DefaultUserSettingService.java:160)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  • INFO 2016-03-04 16:13:13,154 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,155 ‘admin’ delete org.hisp.dhis.user.UserCredentials, name: admin admin (AuditLogUtil.java [qtp1727373358-105])
  • INFO 2016-03-04 16:13:13,158 ‘admin’ delete org.hisp.dhis.user.User, name: user new, uid: bSJzGJPYnWi (AuditLogUtil.java [qtp1727373358-105])
  • WARN 2016-03-04 16:13:13,174 SQL Error: 0, SQLState: 23503 (SqlExceptionHelper.java [qtp1727373358-105])
  • ERROR 2016-03-04 16:13:13,175 ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”. (SqlExceptionHelper.java [qtp1727373358-105])

  • ERROR 2016-03-04 16:13:13,175 Error while executing action (ExceptionInterceptor.java [qtp1727373358-105])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [fk_usersetting_userinfoid]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)

at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)

at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table “userinfo” violates foreign key constraint “fk_usersetting_userinfoid” on table “usersetting”

Detail: Key (userinfoid)=(289) is still referenced from table “usersetting”.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

Could you please help fix this.

Regards,

Archana Chillala
Application Developer
Email
archanac@thoughtworks.com
Telephone
+91 9100960533
ThoughtWorks


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

http://www.dhis2.org