dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #45630
Re: [Bug 1538443] Re: Metadata import of users fails
Thank you Morten. Will explore this and revert.
Sent from my BlackBerry 10 smartphone.
Original Message
From: Morten Olav Hansen
Sent: Friday, 24 June 2016 00:35
To: dhis2-devs@xxxxxxxxxxxxxxxxxxx
Reply To: Bug 1538443
Subject: Re: [Dhis2-devs] [Bug 1538443] Re: Metadata import of users fails
It's only available as a API at this point (probably will be changed in
2.25), and yes you can import multiple users at the same time.
If you are using json you can use something like this:
curl -X POST -d @file.json -H "Content-Type: application/json" -u
username:password http://server/api/23/metadata
Or xml:
curl -X POST -d @file.xml -H "Content-Type: application/xml" -u
username:password http://server/api/23/metadata
You can read more about it here:
http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s14.html
If you are using windows and don't have access to cURL, you can install
this package:
https://github.com/bmatzelle/gow
--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Fri, Jun 24, 2016 at 5:05 AM, <ifeanyiokoye@xxxxxxxxx> wrote:
> Hello Morten,
>
> Would the upgrade to 2.23 allow me to do the import from the metadata
> import app or I would have to do it from the API?
> If I had to do it from the API, is there step-by-step guidance on how to
> do this? I have to import 59 users and would I have to do that one after
> the other or as a batch?
>
> Thank you.
>
> Regards,
>
>
> Ifeanyi
>
> Original Message
> From: Morten Olav Hansen
> Sent: Thursday, 23 June 2016 17:56
> To: dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Reply To: Bug 1538443
> Subject: Re: [Dhis2-devs] [Bug 1538443] Re: Metadata import of users fails
>
> Hi
>
> Are you able to update to 2.23? in 2.23 we have a new importer at the
> /api/23/metadata endpoint which has much better support for (among other
> types) users
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Thu, Jun 23, 2016 at 6:13 PM, Ifeanyi Okoye <1538443@xxxxxxxxxxxxxxxxxx
> >
> wrote:
>
> > Hello,
> > I am trying to move data from one instance of DHIS2 (2.22) to another
> > using metadata export and import. So far everything else has worked
> except
> > for importing users. It just goes on indefinitely.
> >
> > Please see the logs below:
> >
> > * ERROR 2016-06-23 01:31:31,479 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.GeneratedMethodAccessor204.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: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.$Proxy35.getUserCredentialsByUsername(Unknown
> > Source)
> > at
> >
> org.hisp.dhis.user.DefaultCurrentUserService.getCurrentUser(DefaultCurrentUserService.java:92)
> > at sun.reflect.GeneratedMethodAccessor161.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: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.$Proxy18.getCurrentUser(Unknown Source)
> > at
> >
> org.hisp.dhis.hibernate.HibernateGenericStore.getSharingCriteria(HibernateGenericStore.java:207)
> > at
> >
> org.hisp.dhis.hibernate.HibernateGenericStore.getSharingCriteria(HibernateGenericStore.java:200)
> > at
> >
> org.hisp.dhis.hibernate.HibernateGenericStore.getSharingCriteria(HibernateGenericStore.java:275)
> > at
> >
> org.hisp.dhis.hibernate.HibernateGenericStore.getSharingObject(HibernateGenericStore.java:307)
> > at
> >
> org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore.getByUid(HibernateIdentifiableObjectStore.java:107)
> > at
> >
> org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore.getByUid(HibernateIdentifiableObjectStore.java:57)
> > at
> >
> org.hisp.dhis.common.DefaultIdentifiableObjectManager.get(DefaultIdentifiableObjectManager.java:189)
> > at sun.reflect.GeneratedMethodAccessor567.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: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.$Proxy76.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.getObjects(DefaultObjectBridge.java:421)
> > at
> >
> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.validateForNewStrategy(DefaultIdentifiableObjectImporter.java:700)
> > at
> >
> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.validateIdentifiableObject(DefaultIdentifiableObjectImporter.java:651)
> > at
> >
> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:536)
> > at
> >
> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjects(DefaultIdentifiableObjectImporter.java:192)
> > 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(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: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.$Proxy201.importMetaData(Unknown Source)
> > 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: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.$Proxy152.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)
> >
> >
> > Is there a solution to this issue?
> >
> > --
> > You received this bug notification because you are a bug assignee.
> > 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
> >
>
> --
> 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
>
> _______________________________________________
> 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
>
--
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
_______________________________________________
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
--
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