← Back to team overview

dhis2-devs team mailing list archive

Re: what wrong with import metadata?

 

Hello !

I have a workaround for this,

I THINK this error raises when the users or the usergroups that appears in
the metadata dont exists in the target platform. If you don't want or you
cant have these users/usergroups in the target platform you have to export
without sharing settings (as Olav proposed)

but

if you export something with dependencies (where you cannot export without
sharing) you have to remove it from the xml/json exported.

the problem is that you  will remove all the sharing settings of all the
dependencies (maybe some dataelements are shared between more than one
dataset and removing that would not be a good idea).

If you still can deal with that risk, here are two regular expressions to
remove that easily (only for xml, you can adapt to json):

<userGroupAccesses>(.|\n)+?(?=</userGroupAccesses>)</userGroupAccesses>
<userAccesses>(.|\n)+?(?=</userAccesses>)</userAccesses>

Hope this workaround helps in the meantime...

2017-11-30 15:36 GMT+01:00 林晓东 <lin_xd@xxxxxxx>:

> No more news
>
>
>
>
> --
> 此致
>
> easy
>
> 莫愁前路无知己,天下谁人不识君。
>
> At 2017-11-28 17:18:50, "Ramón José Jiménez Pomareta" <dhis2@xxxxxxxxxxx>
> wrote:
>
> Hello,
>
> I have also the same problem exporting and importing a legendSet through
> the API. (GET and POST/PUT).
>
> Do you have any news ? Thanks !
>
> 2017-10-27 11:21 GMT+02:00 Ramón José Jiménez Pomareta <dhis2@xxxxxxxxxxx>
> :
>
>> I had the same issue importing groups "with sharing". Do you know what is
>> happening? I'ts going to be corrected? Thank you !
>>
>> 2017-06-08 6:12 GMT+02:00 Morten Olav Hansen <morten@xxxxxxxxx>:
>>
>>> Hi
>>>
>>> I'm looking into it, but could you try to export without sharing, and
>>> see if that helps?
>>>
>>> --
>>> Morten Olav Hansen
>>> Senior Engineer, DHIS 2
>>> University of Oslo
>>> http://www.dhis2.org
>>>
>>> On Wed, Jun 7, 2017 at 10:03 PM, 林晓东 <lin_xd@xxxxxxx> wrote:
>>>
>>>> hi,all
>>>>  Here is the error of my importing from export file at dhis2.org demo.
>>>>  (windows10, dhis2 2.27,jdk.1.8)
>>>> what's mean?
>>>>
>>>>
>>>> * INFO  2017-06-07 23:00:37,958 [Level: INFO, category:
>>>> METADATA_IMPORT, time: Wed Jun 07 23:00:37 CST 2017, message: (admin)
>>>> Creating 894 object(s) of type DataElement] (InMemoryNotifier.java
>>>> [taskScheduler-6])
>>>> * ERROR 2017-06-07 23:00:38,802 Unexpected error occurred in scheduled
>>>> task. (TaskUtils.java [taskScheduler-6])
>>>> org.hibernate.TransientObjectException: object references an unsaved
>>>> transient instance - save the transient instance before flushing:
>>>> org.hisp.dhis.user.UserGroup
>>>>         at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifie
>>>> rIfNotUnsaved(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.findD
>>>> irty(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.f
>>>> lushEntities(AbstractFlushingEventListener.java:216)
>>>>         at org.hibernate.event.internal.AbstractFlushingEventListener.f
>>>> lushEverythingToExecutions(AbstractFlushingEventListener.java:85)
>>>>         at org.hibernate.event.internal.DefaultAutoFlushEventListener.o
>>>> nAutoFlush(DefaultAutoFlushEventListener.java:44)
>>>>         at org.hibernate.internal.SessionImpl.autoFlushIfRequired(Sessi
>>>> onImpl.java:1264)
>>>>         at org.hibernate.internal.SessionImpl.list(SessionImpl.java:178
>>>> 0)
>>>>         at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:3
>>>> 63)
>>>>         at org.hisp.dhis.deletedobject.hibernate.HibernateDeletedObject
>>>> Store.query(HibernateDeletedObjectStore.java:162)
>>>>         at org.hisp.dhis.deletedobject.hibernate.HibernateDeletedObject
>>>> Store.delete(HibernateDeletedObjectStore.java:71)
>>>>         at org.hisp.dhis.deletedobject.DefaultDeletedObjectService.dele
>>>> teDeletedObjects(DefaultDeletedObjectService.java:65)
>>>>         at sun.reflect.GeneratedMethodAccessor619.invoke(Unknown
>>>> Source)
>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>>> thodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>         at org.springframework.aop.support.AopUtils.invokeJoinpointUsin
>>>> gReflection(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.TransactionInter
>>>> ceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>>>>         at org.springframework.transaction.interceptor.TransactionAspec
>>>> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
>>>>         at org.springframework.transaction.interceptor.TransactionInter
>>>> ceptor.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.$Proxy57.deleteDeletedObjects(Unknown Source)
>>>>         at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundle
>>>> Service.handleCreates(DefaultObjectBundleService.java:228)
>>>>         at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundle
>>>> Service.commit(DefaultObjectBundleService.java:153)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>>> ssorImpl.java:62)
>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>>> thodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>         at org.springframework.aop.support.AopUtils.invokeJoinpointUsin
>>>> gReflection(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.TransactionInter
>>>> ceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>>>>         at org.springframework.transaction.interceptor.TransactionAspec
>>>> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
>>>>         at org.springframework.transaction.interceptor.TransactionInter
>>>> ceptor.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.imp
>>>> ortMetadata(DefaultMetadataImportService.java:127)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>>> ssorImpl.java:62)
>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>>> thodAccessorImpl.java:43)
>>>>         at java.lang.reflect.Method.invoke(Method.java:498)
>>>>         at org.springframework.aop.support.AopUtils.invokeJoinpointUsin
>>>> gReflection(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.TransactionInter
>>>> ceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>>>>         at org.springframework.transaction.interceptor.TransactionAspec
>>>> tSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
>>>>         at org.springframework.transaction.interceptor.TransactionInter
>>>> ceptor.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.ca
>>>> ll(ImportMetaDataTask.java:99)
>>>>         at org.hisp.dhis.security.SecurityContextRunnable.run(SecurityC
>>>> ontextRunnable.java:57)
>>>>         at org.springframework.scheduling.support.DelegatingErrorHandli
>>>> ngRunnable.run(DelegatingErrorHandlingRunnable.java:54)
>>>>         at java.util.concurrent.Executors$RunnableAdapter.call(Executor
>>>> s.java:511)
>>>>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFu
>>>> tureTask.access$201(ScheduledThreadPoolExecutor.java:180)
>>>>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFu
>>>> tureTask.run(ScheduledThreadPoolExecutor.java:293)
>>>>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>>>> Executor.java:1142)
>>>>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>>>> lExecutor.java:617)
>>>>         at java.lang.Thread.run(Thread.java:745)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 此致
>>>>
>>>>    林晓东
>>>>
>>>> 莫愁前路无知己,天下谁人不识君。
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
>
>
>

References