← Back to team overview

dhis2-devs team mailing list archive

DHIS2 Metadata Sync error

 

Hello DHIS team,
we are trying the metadata sync feature but unfortunately it does not seem
to work.

Note: on our setup instance2 is going to sync from instance1

What we tried so far:
Case 1:
- manually import metdata from a json file to instance1
- upgrade instance1 running v2.22 to v2.24, everything went fine
- create a 'metadata version' on instance1
- configure instance2 to sync from instance1
- trigger the sync with the 'sync now' button

Case 2:
- manually import metdata from a json file to instance1
- upgrade instance1 running v2.22 to v2.24, everything went fine
- save the dump of instance1's database
- restore the dump of instance1's to instance2's database
- create a 'metadata version' on instance1
- configure instance2 to sync from instance1
- trigger the sync with the 'sync now' button

We were following this guide:
https://dhis2.github.io/dhis2-docs/master/en/user/html/dataA
dmin_metaDataSync.html

On both cases the sync fails, error logs from instance2 attached.

Any hint on how to get the metadata sync working?

Thanks
dhis2_1    | * INFO  2016-10-24 11:44:03,412 (system-process) Creating 64 object(s) of type ValidationRule (DefaultObjectBundleService.java [taskScheduler-8])
dhis2_1    | * ERROR 2016-10-24 11:44:03,758 Exception occurred while trying to import the metadata. object references an unsaved transient instance - save the transient instance before flushing: org.hisp.dhis.dataelement.DataElement (MetadataSyncImportHandler.java [taskScheduler-8])
dhis2_1    | org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.hisp.dhis.dataelement.DataElement
dhis2_1    |    at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:279)
dhis2_1    |    at org.hibernate.type.EntityType.getIdentifier(EntityType.java:455)
dhis2_1    |    at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:144)
dhis2_1    |    at org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:888)
dhis2_1    |    at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1307)
dhis2_1    |    at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:50)
dhis2_1    |    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:560)
dhis2_1    |    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:434)
dhis2_1    |    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
dhis2_1    |    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
dhis2_1    |    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1295)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata2.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:156)
dhis2_1    |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
dhis2_1    |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
dhis2_1    |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
dhis2_1    |    at java.lang.reflect.Method.invoke(Method.java:498)
dhis2_1    |    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
dhis2_1    |    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
dhis2_1    |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
dhis2_1    |    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
dhis2_1    |    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
dhis2_1    |    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
dhis2_1    |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
dhis2_1    |    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
dhis2_1    |    at com.sun.proxy.$Proxy188.commit(Unknown Source)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata2.DefaultMetadataImportService.importMetadata(DefaultMetadataImportService.java:104)
dhis2_1    |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
dhis2_1    |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
dhis2_1    |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
dhis2_1    |    at java.lang.reflect.Method.invoke(Method.java:498)
dhis2_1    |    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
dhis2_1    |    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
dhis2_1    |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
dhis2_1    |    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
dhis2_1    |    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
dhis2_1    |    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
dhis2_1    |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
dhis2_1    |    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
dhis2_1    |    at com.sun.proxy.$Proxy190.importMetadata(Unknown Source)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata.sync.MetadataSyncImportHandler.importMetadata(MetadataSyncImportHandler.java:95)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata.sync.DefaultMetadataSyncService.doMetadataSync(DefaultMetadataSyncService.java:148)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata.tasks.MetadataSyncTask.handleMetadataSync(MetadataSyncTask.java:172)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata.tasks.MetadataSyncTask.runSyncTask(MetadataSyncTask.java:144)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata.tasks.MetadataSyncTask.lambda$run$0(MetadataSyncTask.java:113)
dhis2_1    |    at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
dhis2_1    |    at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:168)
dhis2_1    |    at org.hisp.dhis.dxf2.metadata.tasks.MetadataSyncTask.run(MetadataSyncTask.java:110)
dhis2_1    |    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
dhis2_1    |    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
dhis2_1    |    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
dhis2_1    |    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
dhis2_1    |    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
dhis2_1    |    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
dhis2_1    |    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
dhis2_1    |    at java.lang.Thread.run(Thread.java:745)
dhis2_1    | * INFO  2016-10-24 11:44:03,762 Metadata Sync Summary: MetadataSyncSummary{importReport=null, importSummary=null, metadataVersion={"importDate": "null", "type": "BEST_EFFORT", "name": "Version_1"}} (DefaultMetadataSyncService.java [taskScheduler-8])
dhis2_1    | * INFO  2016-10-24 11:44:03,763 Failure mail will be sent with the following message: Following Exceptions were encountered while the scheduler run for metadata sync
dhis2_1    |
dhis2_1    | ERROR_CATEGORY : metadataSync
dhis2_1    |  ERROR_VALUE : Import of metadata objects was unsuccessful
dhis2_1    |
dhis2_1    | ERROR_CATEGORY : version
dhis2_1    |  ERROR_VALUE : {"importDate": "null", "type": "BEST_EFFORT", "name": "Version_1"}
dhis2_1    |
dhis2_1    |  (MetadataSyncPostProcessor.java [taskScheduler-8])
dhis2_1    | * INFO  2016-10-24 11:44:03,774 Aborting Metadata sync Import Failure happened. Check mail and logs for more details. (MetadataSyncPostProcessor.java [taskScheduler-8])
dhis2_1    | * INFO  2016-10-24 11:44:03,775 Metadata Sync cron Job ended  (MetadataSyncTask.java [taskScheduler-8])


CONTAINER ID        IMAGE                                                 COMMAND             CREATED             STATUS              PORTS                    NAMES
73fef7d570d5        docker-registry.eocng.org/ehealthafrica/van:2.14.11   "/start.sh"         4 months ago        Up 6 weeks          127.0.0.1:8092->80/tcp   van_2.14.11

Follow ups