← Back to team overview

dhis2-devs team mailing list archive

Re: Sync of admin user fails when modifying 'admin'

 

Here's a sample payload for the issue mentioned.


{
 "date": "2016-03-28T09:25:10.323+0000",
 "users": [
   {
     "code": "admin",
     "created": "2016-03-22T11:02:03.749+0000",
     "lastUpdated": "2016-03-28T09:25:06.034+0000",
     "id": "M5zQapPyTZI",
     "firstName": "admin",
     "surname": "admin",
     "email": "nalinim@xxxxxxxxxxxxxxxx",
     "userCredentials": {
       "code": "admin",
       "created": "2016-03-22T11:02:03.787+0000",
       "lastUpdated": "2016-03-28T09:25:06.032+0000",
       "id": "Cexdz32gWas",
       "lastLogin": "2016-03-22T11:02:03.787+0000",
       "passwordLastUpdated": "2016-03-22T11:02:03.788+0000",
       "invitation": false,
       "externalAuth": false,
       "selfRegistered": false,
       "disabled": false,
       "username": "admin",
       "userInfo": {
         "id": "M5zQapPyTZI"
       },
       "user": {
         "id": "M5zQapPyTZI"
       },
       "cogsDimensionConstraints": [],
       "catDimensionConstraints": [],
       "userRoles": [
         {
           "id": "yrB6vc5Ip3r"
         }
       ]
     },
     "attributeValues": [],
     "teiSearchOrganisationUnits": [],
     "organisationUnits": [
       {
         "id": "nRFBGboJZ76"
       }
     ],
     "dataViewOrganisationUnits": []
   }
 ]
}

Archana Chillala
Application Developer
Email archanac@xxxxxxxxxxxxxxxx
Telephone +91 9100960533 <+91+9100960533>
[image: ThoughtWorks]
<http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>

On Mon, Mar 28, 2016 at 4:29 PM, Archana Chillala <archanac@xxxxxxxxxxxxxxxx
> wrote:

> Hi Morten,
>
> I am using DHIS version 2.23 with the new importer. I am using two
> instances of DHIS for metadata sync. Whenever I make some changes to the
> *admin* user on one instance and sync into the other, the Sync fails and
> throws an exception. However, if I create a new user, and make
> modifications, the sync is successful (Throws no exceptions)
> Is this a known issue?
>
>
> Following is the Log trace for the exception:
>
>
> * WARN  2016-03-28 14:55:14,258 SQL Error: 0, SQLState: 23505
> (SqlExceptionHelper.java [qtp1727373358-379])
>
> ** ERROR 2016-03-28 14:55:14,258 ERROR: duplicate key value violates
> unique constraint "uk_ktwf16f728hce9ahtpmm7w5lx"*
>
> *  Detail: Key (uid)=(ARhWqW6Lohm) already exists.
> (SqlExceptionHelper.java [qtp1727373358-379])*
>
> ** ERROR 2016-03-28 14:55:14,259 Exception occurred while trying to import
> the metadata. could not execute statement; SQL [n/a]; constraint
> [uk_ktwf16f728hce9ahtpmm7w5lx]; nested exception is
> org.hibernate.exception.ConstraintViolationException: could not execute
> statement (DefaultMetadataSyncService.java [qtp1727373358-379])*
>
> *org.springframework.dao.DataIntegrityViolationException: could not
> execute statement; SQL [n/a]; constraint [uk_ktwf16f728hce9ahtpmm7w5lx];
> 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.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
>
>     at com.sun.proxy.$Proxy141.addVersion(Unknown Source)
>
>     at
> org.hisp.dhis.dxf2.metadata.sync.DefaultMetadataSyncService.doMetadataSync(DefaultMetadataSyncService.java:211)
>
>     at
> org.hisp.dhis.webapi.controller.metadata.sync.MetadataSyncController.metadataSync(MetadataSyncController.java:78)
>
>     at sun.reflect.GeneratedMethodAccessor1041.invoke(Unknown Source)
>
>     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)
>
>     at
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
>
>     at
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
>
>     at
> org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
>
>     at
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
>
>     at
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
>
>
>
> Could you please help fix this?
>
>
>
> *Thanks*
>
> Archana Chillala
> Application Developer
> Email archanac@xxxxxxxxxxxxxxxx
> Telephone +91 9100960533 <+91+9100960533>
> [image: ThoughtWorks]
> <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>
>

Follow ups

References