[Issue] Replicating a user throws exception

Hi,

I am currently using the latest code of DHIS taken from the trunk. I am trying to create new users by replicating an existing user ('Replicate’ available from the context menu of users). However, whenever I assign a username, password and click on “Replicate”, an exception is thrown in the logs and there’s a warning shown on the DHIS header.

Attached are screenshots depicting the issue mentioned.

Here are the logs for the exception thrown:

  • INFO 2016-03-29 15:50:39,210 ‘admin’ create org.hisp.dhis.user.User, name: local admin, uid: cIE6puaCJvv (AuditLogUtil.java [qtp598569407-849])

  • INFO 2016-03-29 15:50:39,211 ‘admin’ create org.hisp.dhis.user.User, name: local admin, uid: cIE6puaCJvv (AuditLogUtil.java [qtp598569407-849])

  • INFO 2016-03-29 15:50:39,216 ‘admin’ create org.hisp.dhis.user.UserCredentials, name: admin admin, uid: mvhV4HHH0YF (AuditLogUtil.java [qtp598569407-849])

* WARN 2016-03-29 15:50:39,218 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [qtp598569407-849])

* ERROR 2016-03-29 15:50:39,218 ERROR: duplicate key value violates unique constraint "uk_efqukogbk7i0poucwoy2qie74"

** Detail: Key (uid)=(mvhV4HHH0YF) already exists. (SqlExceptionHelper.java [qtp598569407-849])**

* ERROR 2016-03-29 15:50:39,219 Exception happened while trying to invoke the request URL:/api/users/o47o9bP7Okh/replica (CrudControllerAdvice.java [qtp598569407-849])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [uk_efqukogbk7i0poucwoy2qie74]; 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:761)

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

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

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

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

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)

at com.sun.proxy.$Proxy63.addUserCredentials(Unknown Source)

at org.hisp.dhis.webapi.controller.user.UserController.replicateUser(UserController.java:360)

at org.hisp.dhis.webapi.controller.user.UserController$$FastClassBySpringCGLIB$$e199246.invoke(<generated>)

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)

at org.hisp.dhis.webapi.controller.user.UserController$$EnhancerBySpringCGLIB$$66052cb1.replicateUser(<generated>)

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)

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

Could anyone help fix this?

Thanks

···

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

Hi,

This has already even reported here
https://bugs.launchpad.net/dhis2/+bug/1557996.

It is helpful to the developers if you can place your bugs in launchpad, particularly if you can reproduce them. There is often a lot of traffic on this list and it’s easy to lose track of them.

Regards,

Jason

image

image

···

On Tue, Mar 29, 2016, 13:53 Archana Chillala archanac@thoughtworks.com wrote:

Hi,

I am currently using the latest code of DHIS taken from the trunk. I am trying to create new users by replicating an existing user ('Replicate’ available from the context menu of users). However, whenever I assign a username, password and click on “Replicate”, an exception is thrown in the logs and there’s a warning shown on the DHIS header.

Attached are screenshots depicting the issue mentioned.

Inline image 2

Inline image 1

Here are the logs for the exception thrown:

  • INFO 2016-03-29 15:50:39,210 ‘admin’ create org.hisp.dhis.user.User, name: local admin, uid: cIE6puaCJvv (AuditLogUtil.java [qtp598569407-849])
  • INFO 2016-03-29 15:50:39,211 ‘admin’ create org.hisp.dhis.user.User, name: local admin, uid: cIE6puaCJvv (AuditLogUtil.java [qtp598569407-849])
  • INFO 2016-03-29 15:50:39,216 ‘admin’ create org.hisp.dhis.user.UserCredentials, name: admin admin, uid: mvhV4HHH0YF (AuditLogUtil.java [qtp598569407-849])

* WARN 2016-03-29 15:50:39,218 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [qtp598569407-849])

* ERROR 2016-03-29 15:50:39,218 ERROR: duplicate key value violates unique constraint "uk_efqukogbk7i0poucwoy2qie74"

** Detail: Key (uid)=(mvhV4HHH0YF) already exists. (SqlExceptionHelper.java [qtp598569407-849])**

* ERROR 2016-03-29 15:50:39,219 Exception happened while trying to invoke the request URL:/api/users/o47o9bP7Okh/replica (CrudControllerAdvice.java [qtp598569407-849])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [uk_efqukogbk7i0poucwoy2qie74]; 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:761)

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

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

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

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

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)

at com.sun.proxy.$Proxy63.addUserCredentials(Unknown Source)

at org.hisp.dhis.webapi.controller.user.UserController.replicateUser(UserController.java:360)

at org.hisp.dhis.webapi.controller.user.UserController$$FastClassBySpringCGLIB$$e199246.invoke()

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)

at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)

at org.hisp.dhis.webapi.controller.user.UserController$$EnhancerBySpringCGLIB$$66052cb1.replicateUser()

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)

at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)

at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)

at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

Could anyone help fix this?

Thanks

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


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

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

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

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

Thanks, Jason.

···

On Tue, Mar 29, 2016 at 5:56 PM, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi,
This has already even reported here
https://bugs.launchpad.net/dhis2/+bug/1557996.

It is helpful to the developers if you can place your bugs in launchpad, particularly if you can reproduce them. There is often a lot of traffic on this list and it’s easy to lose track of them.

Regards,

Jason

On Tue, Mar 29, 2016, 13:53 Archana Chillala archanac@thoughtworks.com wrote:

Hi,

I am currently using the latest code of DHIS taken from the trunk. I am trying to create new users by replicating an existing user ('Replicate’ available from the context menu of users). However, whenever I assign a username, password and click on “Replicate”, an exception is thrown in the logs and there’s a warning shown on the DHIS header.

Attached are screenshots depicting the issue mentioned.

Here are the logs for the exception thrown:

  • INFO 2016-03-29 15:50:39,210 ‘admin’ create org.hisp.dhis.user.User, name: local admin, uid: cIE6puaCJvv (AuditLogUtil.java [qtp598569407-849])
  • INFO 2016-03-29 15:50:39,211 ‘admin’ create org.hisp.dhis.user.User, name: local admin, uid: cIE6puaCJvv (AuditLogUtil.java [qtp598569407-849])
  • INFO 2016-03-29 15:50:39,216 ‘admin’ create org.hisp.dhis.user.UserCredentials, name: admin admin, uid: mvhV4HHH0YF (AuditLogUtil.java [qtp598569407-849])

* WARN 2016-03-29 15:50:39,218 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [qtp598569407-849])

* ERROR 2016-03-29 15:50:39,218 ERROR: duplicate key value violates unique constraint "uk_efqukogbk7i0poucwoy2qie74"

** Detail: Key (uid)=(mvhV4HHH0YF) already exists. (SqlExceptionHelper.java [qtp598569407-849])**

* ERROR 2016-03-29 15:50:39,219 Exception happened while trying to invoke the request URL:/api/users/o47o9bP7Okh/replica (CrudControllerAdvice.java [qtp598569407-849])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [uk_efqukogbk7i0poucwoy2qie74]; 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:761)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
at com.sun.proxy.$Proxy63.addUserCredentials(Unknown Source)
at org.hisp.dhis.webapi.controller.user.UserController.replicateUser(UserController.java:360)
at org.hisp.dhis.webapi.controller.user.UserController$$FastClassBySpringCGLIB$$e199246.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.hisp.dhis.webapi.controller.user.UserController$$EnhancerBySpringCGLIB$$66052cb1.replicateUser(<generated>)
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)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)

Could anyone help fix this?

Thanks

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


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

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

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

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

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