← Back to team overview

dhis2-devs team mailing list archive

[Bug 1538443] Re: Metadata import of users fails

 

Hi Morten,

I'm experiencing this exact issue with version 2.22 revision 21963.

I am importing Users and Roles from another DHIS2 instance.

Full logs & stack trace:

* INFO  2016-04-05 02:31:24,123 User 'admin' started import at Tue Apr 05 02:31:24 UTC 2016 (DefaultImportService.java [taskScheduler-2])
* INFO  2016-04-05 02:31:24,124 [Level: INFO, category: METADATA_IMPORT, time: Tue Apr 05 02:31:24 UTC 2016, message: Importing meta-data] (InMemoryNotifier.java [taskScheduler-2])
* INFO  2016-04-05 02:31:24,126 Building object-bridge maps (preheatCache: true, 67 classes). (DefaultObjectBridge.java [taskScheduler-2])
* INFO  2016-04-05 02:31:24,608 Building object-bridge maps took 0.48 seconds. (DefaultObjectBridge.java [taskScheduler-2])
* WARN  2016-04-05 02:31:24,609 Can not find getter for 'oAuth2Clients'. (DefaultImportService.java [taskScheduler-2])
* INFO  2016-04-05 02:31:24,609 [Level: INFO, category: METADATA_IMPORT, time: Tue Apr 05 02:31:24 UTC 2016, message: Importing 22 Users] (InMemoryNotifier.java [taskScheduler-2])
* INFO  2016-04-05 02:31:24,637 'admin' create org.hisp.dhis.user.User, name: Carlos Carlos, uid: v2OmwTSJbAB (AuditLogUtil.java [taskScheduler-2])
* INFO  2016-04-05 02:31:24,659 'admin' update org.hisp.dhis.user.User, name: Carlos Carlos, uid: v2OmwTSJbAB (AuditLogUtil.java [taskScheduler-2])
* ERROR 2016-04-05 02:31:24,662 Unexpected error occurred in scheduled task. (TaskUtils.java [taskScheduler-2])
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.hisp.dhis.user.User
        at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:249)
        at org.hibernate.type.EntityType.getIdentifier(EntityType.java:536)
        at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:311)
        at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:321)
        at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:294)
        at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4049)
        at org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:537)
        at org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:235)
        at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:164)
        at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:230)
        at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:100)
        at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:61)
        at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1166)
        at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1223)
        at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
        at org.hibernate.internal.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:909)
        at org.hisp.dhis.user.hibernate.HibernateUserCredentialsStore.getUserCredentialsByUsername(HibernateUserCredentialsStore.java:48)
        at org.hisp.dhis.user.DefaultUserService.getUserCredentialsByUsername(DefaultUserService.java:567)
        at sun.reflect.GeneratedMethodAccessor169.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        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:207)
        at com.sun.proxy.$Proxy36.getUserCredentialsByUsername(Unknown Source)
        at org.hisp.dhis.user.DefaultCurrentUserService.getCurrentUser(DefaultCurrentUserService.java:92)
        at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        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:207)
        at com.sun.proxy.$Proxy77.get(Unknown Source)
        at org.hisp.dhis.dxf2.metadata.DefaultObjectBridge.getUidMatch(DefaultObjectBridge.java:722)
        at org.hisp.dhis.dxf2.metadata.DefaultObjectBridge.findMatches(DefaultObjectBridge.java:526)
        at org.hisp.dhis.dxf2.metadata.DefaultObjectBridge.getObject(DefaultObjectBridge.java:384)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.findObjectByReference(DefaultIdentifiableObjectImporter.java:757)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.reattachCollectionFields(DefaultIdentifiableObjectImporter.java:844)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.newObject(DefaultIdentifiableObjectImporter.java:365)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.startImport(DefaultIdentifiableObjectImporter.java:582)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:537)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjects(DefaultIdentifiableObjectImporter.java:191)
        at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImportService.java:260)
        at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(DefaultImportService.java:176)
        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:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
        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:207)
        at com.sun.proxy.$Proxy207.importMetaData(Unknown Source)
        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:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy153.importMetaData(Unknown Source)
        at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.call(ImportMetaDataTask.java:99)
        at org.hisp.dhis.security.SecurityContextRunnable.run(SecurityContextRunnable.java:57)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1538443

Title:
  Metadata import of users fails

Status in DHIS:
  Fix Released

Bug description:
  I am using two instances of DHIS. I have exported metadata from one instance of DHIS and imported that into another instance of DHIS. But the import process fails at users. When I try importing metadata without "users", import is successful. 
  While importing metadata with users, The log says - "object references an unsaved transient instance".  I have also gone through some threads raising similar issues, and heard that import of users is disabled or not supported. If so, is there a way we can import users? Could you please elaborate on that. 

  Current user:
  admin
  Version:
  2.21
  Build revision:
  20983
  User agent:
  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1538443/+subscriptions


References