← Back to team overview

dhis2-users team mailing list archive

Re: Has metadata import stopped working?

 

Hi Knut
Try splitting your import by org unit levels and do the import in order,
starting with the lowest level (1, 2, 3...)
The problem happens because the import creates the objects out of order in
regards to dependencies, in your case an org unit before its parent.
Best regards,
JM

On Fri, 6 Apr 2018, 15:57 Olav Poppe, <olavpo@xxxxxxxxxx> wrote:

> I’m having the same issue and error importing into an empty 2.27 database.
> Though in this case a slightly modified dependency export of a tracker
> programme, not orgunits.
>
> Knut, did you find a solution?
>
> Sending you the payload, Morten.
>
> Olav
>
>
> 12. jan. 2018 kl. 08:39 skrev Morten Olav Hansen <morten@xxxxxxxxx>:
>
> That sounds weird Knut, would you mind sharing the org unit payload?
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Fri, Jan 12, 2018 at 2:19 AM, Knut Staring <knutst@xxxxxxxxx> wrote:
>
>> I have tried doing metadata export without sharing from 2.27 and
>> importing into 2.27, just the OU hierarchy and levels.
>>
>> Importing into a clean instance gives this:
>>
>>  INFO  2018-01-11 20:16:06,750 [Level: INFO, category: METADATA_IMPORT,
>> time: Thu Jan 11 20:16:06 CET 2018, message: (admin) Creating 8 object(s)
>> of type OrganisationUnitLevel] (InMemoryNotifier.java [taskScheduler-4])
>> * ERROR 2018-01-11 20:16:07,764 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.organisationunit.OrganisationUnit
>>         at
>> org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:279)
>>         at
>> org.hibernate.type.EntityType.getIdentifier(EntityType.java:462)
>>         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:322)
>>         at
>> org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4204)
>>         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.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:38)
>>         at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
>>         at
>> org.hisp.dhis.dbms.HibernateDbmsManager.clearSession(HibernateDbmsManager.java:339)
>>         at
>> org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:180)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>         at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
>>         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:282)
>>         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:213)
>>         at com.sun.proxy.$Proxy189.commit(Unknown Source)
>>         at
>> org.hisp.dhis.dxf2.metadata.DefaultMetadataImportService.importMetadata(DefaultMetadataImportService.java:127)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>         at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
>>         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:282)
>>         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:213)
>>         at com.sun.proxy.$Proxy191.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(Unknown
>> Source)
>>         at java.util.concurrent.FutureTask.run(Unknown Source)
>>         at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown
>> Source)
>>         at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
>> Source)
>>         at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
>> Source)
>>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
>> Source)
>>         at java.lang.Thread.run(Unknown Source)
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References