[Bug 1538443] [NEW] Metadata import of users fails

Public bug reported:

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

** Affects: dhis2
     Importance: Undecided
         Status: New

···

--
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:
  New

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

** Changed in: dhis2
    Milestone: None => 2.23

** Changed in: dhis2
     Assignee: (unassigned) => Morten Olav Hansen (mortenoh)

** Changed in: dhis2
   Importance: Undecided => Medium

···

--
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:
  New

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

I was able to create a user using the web-api with no issues, could you
please share your full payload and exception? also, were you updating
users or creating new ones? I need a bit more info to be able to
reproduce.

···

--
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:
  New

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

Hi Morten,

I have created users using the UI, and not Web API. I was not updating
users, just creating them. I took an export of metadata from one DHIS
instance (including users) and then tried to import the metadata into
another. But import fails at users.

[image: Inline image 1]
And here are the logs generated:

** INFO * 2016-02-05 10:51:43,742 [Level: INFO, category: METADATA_IMPORT,
time: Fri Feb 05 10:51:43 IST 2016, message: Importing 5 Users]
(InMemoryNotifier.java [taskScheduler-1])
* *INFO * 2016-02-05 10:51:43,761 'admin' update org.hisp.dhis.user.User,
name: admin123 admin123, uid: TGk0oxuEY35 (AuditLogUtil.java
[taskScheduler-1])
* *ERROR* 2016-02-05 10:51:43,777 Unexpected error occurred in scheduled
task. (TaskUtils.java [taskScheduler-1])
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:1616)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
at
org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGenericStore.java:291)
at
org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore.getByUuid(HibernateOrganisationUnitStore.java:81)
at
org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrganisationUnitByUuid(DefaultOrganisationUnitService.java:224)

Thanks.

Archana Chillala
Application Developer
Email archanac@thoughtworks.com
Telephone +91 9100960533 <+91+9100960533>
[image: ThoughtWorks]
<http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>

···

On Fri, Feb 5, 2016 at 9:52 AM, Morten Olav Hansen < 1538443@bugs.launchpad.net> wrote:

I was able to create a user using the web-api with no issues, could you
please share your full payload and exception? also, were you updating
users or creating new ones? I need a bit more info to be able to
reproduce.

--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1538443

Title:
  Metadata import of users fails

Status in DHIS:
  New

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

** Attachment added: "Screen Shot 2016-02-05 at 10.51.56.png"
   https://bugs.launchpad.net/bugs/1538443/+attachment/4564309/+files/Screen%20Shot%202016-02-05%20at%2010.51.56.png

--
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:
  New

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

Ok, I was able to reproduce this locally now. Will look into it and get
back to you.

···

--
Morten

On Fri, Feb 5, 2016 at 12:36 PM, archana <archanac@thoughtworks.com> wrote:

Hi Morten,

I have created users using the UI, and not Web API. I was not updating
users, just creating them. I took an export of metadata from one DHIS
instance (including users) and then tried to import the metadata into
another. But import fails at users.

[image: Inline image 1]
And here are the logs generated:

** INFO * 2016-02-05 10:51:43,742 [Level: INFO, category: METADATA_IMPORT,
time: Fri Feb 05 10:51:43 IST 2016, message: Importing 5 Users]
(InMemoryNotifier.java [taskScheduler-1])
* *INFO * 2016-02-05 10:51:43,761 'admin' update org.hisp.dhis.user.User,
name: admin123 admin123, uid: TGk0oxuEY35 (AuditLogUtil.java
[taskScheduler-1])
* *ERROR* 2016-02-05 10:51:43,777 Unexpected error occurred in scheduled
task. (TaskUtils.java [taskScheduler-1])
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:1616)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
at

org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGenericStore.java:291)
at

org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore.getByUuid(HibernateOrganisationUnitStore.java:81)
at

org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrganisationUnitByUuid(DefaultOrganisationUnitService.java:224)

Thanks.

Archana Chillala
Application Developer
Email archanac@thoughtworks.com
Telephone +91 9100960533 <+91+9100960533>
[image: ThoughtWorks]
<
http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator
>

On Fri, Feb 5, 2016 at 9:52 AM, Morten Olav Hansen < > 1538443@bugs.launchpad.net> wrote:

> I was able to create a user using the web-api with no issues, could you
> please share your full payload and exception? also, were you updating
> users or creating new ones? I need a bit more info to be able to
> reproduce.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1538443
>
> Title:
> Metadata import of users fails
>
> Status in DHIS:
> New
>
> 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
>

** Attachment added: "Screen Shot 2016-02-05 at 10.51.56.png"

https://bugs.launchpad.net/bugs/1538443/+attachment/4564309/+files/Screen%20Shot%202016-02-05%20at%2010.51.56.png

--
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:
  New

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:
  New

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

Thanks, Morten.

Archana Chillala
Application Developer
Email archanac@thoughtworks.com
Telephone +91 9100960533 <+91+9100960533>
[image: ThoughtWorks]
<http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>

···

On Fri, Feb 5, 2016 at 12:08 PM, Morten Olav Hansen < 1538443@bugs.launchpad.net> wrote:

Ok, I was able to reproduce this locally now. Will look into it and get
back to you.

--
Morten

On Fri, Feb 5, 2016 at 12:36 PM, archana <archanac@thoughtworks.com> > wrote:

> Hi Morten,
>
> I have created users using the UI, and not Web API. I was not updating
> users, just creating them. I took an export of metadata from one DHIS
> instance (including users) and then tried to import the metadata into
> another. But import fails at users.
>
> [image: Inline image 1]
> And here are the logs generated:
>
> ** INFO * 2016-02-05 10:51:43,742 [Level: INFO, category:
METADATA_IMPORT,
> time: Fri Feb 05 10:51:43 IST 2016, message: Importing 5 Users]
> (InMemoryNotifier.java [taskScheduler-1])
> * *INFO * 2016-02-05 10:51:43,761 'admin' update org.hisp.dhis.user.User,
> name: admin123 admin123, uid: TGk0oxuEY35 (AuditLogUtil.java
> [taskScheduler-1])
> * *ERROR* 2016-02-05 10:51:43,777 Unexpected error occurred in scheduled
> task. (TaskUtils.java [taskScheduler-1])
> 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:1616)
> at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
> at
org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
> at
>
>
org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGenericStore.java:291)
> at
>
>
org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore.getByUuid(HibernateOrganisationUnitStore.java:81)
> at
>
>
org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrganisationUnitByUuid(DefaultOrganisationUnitService.java:224)
>
>
> Thanks.
>
> Archana Chillala
> Application Developer
> Email archanac@thoughtworks.com
> Telephone +91 9100960533 <+91+9100960533>
> [image: ThoughtWorks]
> <
>
http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator
> >
>
> On Fri, Feb 5, 2016 at 9:52 AM, Morten Olav Hansen < > > 1538443@bugs.launchpad.net> wrote:
>
> > I was able to create a user using the web-api with no issues, could you
> > please share your full payload and exception? also, were you updating
> > users or creating new ones? I need a bit more info to be able to
> > reproduce.
> >
> > --
> > You received this bug notification because you are subscribed to the
bug
> > report.
> > https://bugs.launchpad.net/bugs/1538443
> >
> > Title:
> > Metadata import of users fails
> >
> > Status in DHIS:
> > New
> >
> > 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
> >
>
>
> ** Attachment added: "Screen Shot 2016-02-05 at 10.51.56.png"
>
>
https://bugs.launchpad.net/bugs/1538443/+attachment/4564309/+files/Screen%20Shot%202016-02-05%20at%2010.51.56.png
>
> --
> 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:
> New
>
> 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 subscribed to the bug
report.
https://bugs.launchpad.net/bugs/1538443

Title:
  Metadata import of users fails

Status in DHIS:
  New

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:
  New

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

Please try again with latest 2.21 or newer, should be OK now.

···

--
Morten

On Fri, Feb 5, 2016 at 2:11 PM, archana <archanac@thoughtworks.com> wrote:

Thanks, Morten.

Archana Chillala
Application Developer
Email archanac@thoughtworks.com
Telephone +91 9100960533 <+91+9100960533>
[image: ThoughtWorks]
<
http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator
>

On Fri, Feb 5, 2016 at 12:08 PM, Morten Olav Hansen < > 1538443@bugs.launchpad.net> wrote:

> Ok, I was able to reproduce this locally now. Will look into it and get
> back to you.
>
> --
> Morten
>
> On Fri, Feb 5, 2016 at 12:36 PM, archana <archanac@thoughtworks.com> > > wrote:
>
> > Hi Morten,
> >
> > I have created users using the UI, and not Web API. I was not updating
> > users, just creating them. I took an export of metadata from one DHIS
> > instance (including users) and then tried to import the metadata into
> > another. But import fails at users.
> >
> > [image: Inline image 1]
> > And here are the logs generated:
> >
> > ** INFO * 2016-02-05 10:51:43,742 [Level: INFO, category:
> METADATA_IMPORT,
> > time: Fri Feb 05 10:51:43 IST 2016, message: Importing 5 Users]
> > (InMemoryNotifier.java [taskScheduler-1])
> > * *INFO * 2016-02-05 10:51:43,761 'admin' update
org.hisp.dhis.user.User,
> > name: admin123 admin123, uid: TGk0oxuEY35 (AuditLogUtil.java
> > [taskScheduler-1])
> > * *ERROR* 2016-02-05 10:51:43,777 Unexpected error occurred in
scheduled
> > task. (TaskUtils.java [taskScheduler-1])
> > 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:1616)
> > at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
> > at
> org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
> > at
> >
> >
>
org.hisp.dhis.hibernate.HibernateGenericStore.getObject(HibernateGenericStore.java:291)
> > at
> >
> >
>
org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore.getByUuid(HibernateOrganisationUnitStore.java:81)
> > at
> >
> >
>
org.hisp.dhis.organisationunit.DefaultOrganisationUnitService.getOrganisationUnitByUuid(DefaultOrganisationUnitService.java:224)
> >
> >
> > Thanks.
> >
> > Archana Chillala
> > Application Developer
> > Email archanac@thoughtworks.com
> > Telephone +91 9100960533 <+91+9100960533>
> > [image: ThoughtWorks]
> > <
> >
>
http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator
> > >
> >
> > On Fri, Feb 5, 2016 at 9:52 AM, Morten Olav Hansen < > > > 1538443@bugs.launchpad.net> wrote:
> >
> > > I was able to create a user using the web-api with no issues, could
you
> > > please share your full payload and exception? also, were you updating
> > > users or creating new ones? I need a bit more info to be able to
> > > reproduce.
> > >
> > > --
> > > You received this bug notification because you are subscribed to the
> bug
> > > report.
> > > https://bugs.launchpad.net/bugs/1538443
> > >
> > > Title:
> > > Metadata import of users fails
> > >
> > > Status in DHIS:
> > > New
> > >
> > > 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
> > >
> >
> >
> > ** Attachment added: "Screen Shot 2016-02-05 at 10.51.56.png"
> >
> >
>
https://bugs.launchpad.net/bugs/1538443/+attachment/4564309/+files/Screen%20Shot%202016-02-05%20at%2010.51.56.png
> >
> > --
> > 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:
> > New
> >
> > 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 subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1538443
>
> Title:
> Metadata import of users fails
>
> Status in DHIS:
> New
>
> 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 bug assignee.
https://bugs.launchpad.net/bugs/1538443

Title:
  Metadata import of users fails

Status in DHIS:
  New

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

** Changed in: dhis2
       Status: New => Fix Released

--
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

Hi Morten,

I'm experiencing this exact issue with version 2.22 revision 21963.

I am importing Users and Roles from another DHIS2 instance.

Full logs & stack trace:

* INFO 2016-04-05 02:31:24,123 User 'admin' started import at Tue Apr 05 02:31:24 UTC 2016 (DefaultImportService.java [taskScheduler-2])
* INFO 2016-04-05 02:31:24,124 [Level: INFO, category: METADATA_IMPORT, time: Tue Apr 05 02:31:24 UTC 2016, message: Importing meta-data] (InMemoryNotifier.java [taskScheduler-2])
* INFO 2016-04-05 02:31:24,126 Building object-bridge maps (preheatCache: true, 67 classes). (DefaultObjectBridge.java [taskScheduler-2])
* INFO 2016-04-05 02:31:24,608 Building object-bridge maps took 0.48 seconds. (DefaultObjectBridge.java [taskScheduler-2])
* WARN 2016-04-05 02:31:24,609 Can not find getter for 'oAuth2Clients'. (DefaultImportService.java [taskScheduler-2])
* INFO 2016-04-05 02:31:24,609 [Level: INFO, category: METADATA_IMPORT, time: Tue Apr 05 02:31:24 UTC 2016, message: Importing 22 Users] (InMemoryNotifier.java [taskScheduler-2])
* INFO 2016-04-05 02:31:24,637 'admin' create org.hisp.dhis.user.User, name: Carlos Carlos, uid: v2OmwTSJbAB (AuditLogUtil.java [taskScheduler-2])
* INFO 2016-04-05 02:31:24,659 'admin' update org.hisp.dhis.user.User, name: Carlos Carlos, uid: v2OmwTSJbAB (AuditLogUtil.java [taskScheduler-2])
* ERROR 2016-04-05 02:31:24,662 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.GeneratedMethodAccessor169.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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.$Proxy36.getUserCredentialsByUsername(Unknown Source)
        at org.hisp.dhis.user.DefaultCurrentUserService.getCurrentUser(DefaultCurrentUserService.java:92)
        at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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.$Proxy77.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.getObject(DefaultObjectBridge.java:384)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.findObjectByReference(DefaultIdentifiableObjectImporter.java:757)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.reattachCollectionFields(DefaultIdentifiableObjectImporter.java:844)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.newObject(DefaultIdentifiableObjectImporter.java:365)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.startImport(DefaultIdentifiableObjectImporter.java:582)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjectLocal(DefaultIdentifiableObjectImporter.java:537)
        at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter.importObjects(DefaultIdentifiableObjectImporter.java:191)
        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(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        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.$Proxy207.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:498)
        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.$Proxy153.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(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)

···

--
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

Screen shot of my About DHIS page.

** Attachment added: "About DHIS2 screen shot"
   https://bugs.launchpad.net/dhis2/+bug/1538443/+attachment/4624055/+files/Screenshot%20from%202016-04-05%2012%3A10%3A02.png

···

--
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

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 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

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@bugs.launchpad.net> 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

‎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@lists.launchpad.net
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@bugs.launchpad.net> 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

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

···

On Fri, Jun 24, 2016 at 5:05 AM, ifeanyiokoye@yahoo.com 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@lists.launchpad.net

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@bugs.launchpad.net

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@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

Hi Morten

The plan to move the UI as well to the new importer functionality was supposed to be out in 2.24. Is it not the right understanding?

Regards

Vanya

···

On Fri, Jun 24, 2016 at 4:56 AM, Morten Olav Hansen morten@dhis2.org wrote:

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


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Fri, Jun 24, 2016 at 5:05 AM, ifeanyiokoye@yahoo.com 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@lists.launchpad.net

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@bugs.launchpad.net

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@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

With Regards
ThoughtWorks Technologies

Hyderabad

–Stay Hungry Stay Foolish!!

Hi,

Well, we didn’t have an exact plan for when to switch over the import/export UI, but seeing as we only switched to the new importer in the maintenance app this week, we will wait for 2.25 to switch over the import/export UI (to test it more).

We are probably phasing out the legacy importer in 2.25, so it seems like a good time to then switch over the UI also.

···

On Fri, Jun 24, 2016 at 11:30 AM, Vanya Seth vanyas@thoughtworks.com wrote:

Hi Morten

The plan to move the UI as well to the new importer functionality was supposed to be out in 2.24. Is it not the right understanding?

Regards

Vanya

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Fri, Jun 24, 2016 at 4:56 AM, Morten Olav Hansen morten@dhis2.org wrote:

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


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

With Regards
ThoughtWorks Technologies

Hyderabad

–Stay Hungry Stay Foolish!!

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Fri, Jun 24, 2016 at 5:05 AM, ifeanyiokoye@yahoo.com 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@lists.launchpad.net

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@bugs.launchpad.net

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@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

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@lists.launchpad.net
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:

--
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org

On Fri, Jun 24, 2016 at 5:05 AM, <ifeanyiokoye@yahoo.com> 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@lists.launchpad.net
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@bugs.launchpad.net > > > 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@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
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@lists.launchpad.net
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