← Back to team overview

dhis2-devs team mailing list archive

Exception when importing User and User Role metadata in 2.24

 

Hi,

I am attempting to set up a new empty 2.24 database and populate it with an
export of Org units and Users and User Roles from a different 2.24
database. I exported in xml format, with 2 separate export files for:

   1. Org units / Org Unit Groups / Org Unit Group Sets / Org Unit Levels
   2. Users / User Groups / User Roles


I am able to import the org units just fine. However, when I attempt to
import the User/User Role xml file I get an exception and the metadata
import halts (stacktrace below).

Both instances are running the exact same version of 2.24:

Version:
2.24
Build revision:
294f578
Build date:
2017-03-20 06:21

Note that doing a dry run import shows successfully importing 19 users and
2 UserRoles.

Also note that doing the export and import via json has the same result.

Any help resolving this would be appreciated.

Thanks,

Lorill

* INFO  2017-03-28 15:20:37,221 [Level: INFO, category: METADATA_IMPORT,
time: Tue Mar 28 15:20:37 PDT 2017, message: Importing 19 Users]
(InMemoryNotifier.java [taskScheduler-4])

* INFO  2017-03-28 15:20:37,259 'admin' create org.hisp.dhis.user.User,
name: xxx, uid: spw11k0SXjJ (AuditLogUtil.java [taskScheduler-4])

* INFO  2017-03-28 15:20:37,281 'admin' update org.hisp.dhis.user.User,
name: xxx, uid: spw11k0SXjJ (AuditLogUtil.java [taskScheduler-4])

* INFO  2017-03-28 15:20:37,445 'admin' update org.hisp.dhis.user.User,
name: xxx, uid: spw11k0SXjJ (AuditLogUtil.java [taskScheduler-4])

* ERROR 2017-03-28 15:20:37,460 Unexpected error occurred in scheduled
task. (TaskUtils.java [taskScheduler-4])

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:279)

at org.hibernate.type.EntityType.getIdentifier(EntityType.java:455)

at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:281)

at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:291)

at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:296)

at
org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4126)

at
org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:528)

at
org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:215)

at
org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:142)

at
org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:216)

at
org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:85)

at
org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:44)

at
org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1264)

at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1332)

at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)

at
org.hibernate.internal.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:964)

at
org.hisp.dhis.user.hibernate.HibernateCurrentUserStore.getUserCredentialsByUsername(HibernateCurrentUserStore.java:55)

at
org.hisp.dhis.user.DefaultCurrentUserService.getCurrentUser(DefaultCurrentUserService.java:93)

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

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

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

at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)

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:208)

at com.sun.proxy.$Proxy54.getCurrentUser(Unknown Source)

at
org.hisp.dhis.hibernate.HibernateGenericStore.getSharingCriteria(HibernateGenericStore.java:208)

at
org.hisp.dhis.hibernate.HibernateGenericStore.getSharingCriteria(HibernateGenericStore.java:202)

at
org.hisp.dhis.hibernate.HibernateGenericStore.getSharingCriteria(HibernateGenericStore.java:287)

at
org.hisp.dhis.hibernate.HibernateGenericStore.getSharingObject(HibernateGenericStore.java:319)

at
org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore.getByUid(HibernateIdentifiableObjectStore.java:108)

at
org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore.getByUid(HibernateIdentifiableObjectStore.java:58)

at
org.hisp.dhis.common.DefaultIdentifiableObjectManager.get(DefaultIdentifiableObjectManager.java:244)

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

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

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

at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)

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:208)

at com.sun.proxy.$Proxy68.get(Unknown Source)

at
org.hisp.dhis.dxf2.metadata.DefaultObjectBridge.getUidMatch(DefaultObjectBridge.java:723)

at
org.hisp.dhis.dxf2.metadata.DefaultObjectBridge.findMatches(DefaultObjectBridge.java:527)

at
org.hisp.dhis.dxf2.metadata.DefaultObjectBridge.getObjects(DefaultObjectBridge.java:422)

at
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.validateIdentifiableObject(DefaultIdentifiableObjectImporter.java:690)

at
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:566)

at
org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjects(DefaultIdentifiableObjectImporter.java:191)

at
org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImportService.java:261)

at
org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(DefaultImportService.java:177)

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:483)

at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)

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:208)

at com.sun.proxy.$Proxy241.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:483)

at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)

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:208)

at com.sun.proxy.$Proxy193.importMetaData(Unknown Source)

at
org.hisp.dhis.importexport.action.util.ImportMetaDataTask.call(ImportMetaDataTask.java:103)

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)
-- 
Lorill Crees
Project Leader / Senior Developer
2Paths Solutions Ltd. <http://www.2paths.com>

lcrees@xxxxxxxxxx
skype: lorill2paths
(604) 689-4123 x 15

Follow ups