Errors importing OrgUnits (XML Metadata import)

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)

Hi

Was this exported from /api/metadata or /api/organisationUnits?

···

On Wed Dec 24 2014 at 1:27:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)


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

/api/organisationUnits

···

On Wed, Dec 24, 2014 at 1:32 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Was this exported from /api/metadata or /api/organisationUnits?

On Wed Dec 24 2014 at 1:27:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)


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

That won’t work, then you must add ?inclusionStrategy=NON_EMPTY

To fix this, you must remove all collection objects that are empty from the XML payload, there are differences in the way XML vs JSON is handled in Jackson (the framework we are using for this).

Typically these are elements with plural names, and no body , you can safely remove these.

···

On Wed, Dec 24, 2014 at 1:32 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Was this exported from /api/metadata or /api/organisationUnits?

On Wed Dec 24 2014 at 1:27:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)


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

Thanks for your quick reply, it seems that including inclusionStrategy=NON_EMPTY did the trick! , I am testing it but everything seems to be ok! Thanks!!

Just other quick question: I know we can also import the names of org unit groups, but also the association between org.unit groups and their org. units?

···

On Wed, Dec 24, 2014 at 1:35 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

That won’t work, then you must add ?inclusionStrategy=NON_EMPTY

To fix this, you must remove all collection objects that are empty from the XML payload, there are differences in the way XML vs JSON is handled in Jackson (the framework we are using for this).

Typically these are elements with plural names, and no body , you can safely remove these.

On Wed Dec 24 2014 at 1:34:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

/api/organisationUnits

On Wed, Dec 24, 2014 at 1:32 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Was this exported from /api/metadata or /api/organisationUnits?

On Wed Dec 24 2014 at 1:27:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)


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

Hi again

For groups, you must do this from the orgUnit group side… so you need to export from /api/organisationUnitGroups, and doing that, you can update name etc as you see fit.

···

On Wed, Dec 24, 2014 at 1:35 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

That won’t work, then you must add ?inclusionStrategy=NON_EMPTY

To fix this, you must remove all collection objects that are empty from the XML payload, there are differences in the way XML vs JSON is handled in Jackson (the framework we are using for this).

Typically these are elements with plural names, and no body , you can safely remove these.

On Wed Dec 24 2014 at 1:34:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

/api/organisationUnits

On Wed, Dec 24, 2014 at 1:32 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Was this exported from /api/metadata or /api/organisationUnits?

On Wed Dec 24 2014 at 1:27:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)


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

Good to know, Thanks Morten!

···

On Wed, Dec 24, 2014 at 2:24 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi again

For groups, you must do this from the orgUnit group side… so you need to export from /api/organisationUnitGroups, and doing that, you can update name etc as you see fit.

On Wed Dec 24 2014 at 2:12:16 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Thanks for your quick reply, it seems that including inclusionStrategy=NON_EMPTY did the trick! , I am testing it but everything seems to be ok! Thanks!!

Just other quick question: I know we can also import the names of org unit groups, but also the association between org.unit groups and their org. units?

On Wed, Dec 24, 2014 at 1:35 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

That won’t work, then you must add ?inclusionStrategy=NON_EMPTY

To fix this, you must remove all collection objects that are empty from the XML payload, there are differences in the way XML vs JSON is handled in Jackson (the framework we are using for this).

Typically these are elements with plural names, and no body , you can safely remove these.

On Wed Dec 24 2014 at 1:34:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

/api/organisationUnits

On Wed, Dec 24, 2014 at 1:32 PM, Morten Olav Hansen mortenoh@gmail.com wrote:

Hi

Was this exported from /api/metadata or /api/organisationUnits?

On Wed Dec 24 2014 at 1:27:04 PM Jose Garcia Muñoz josemp10@gmail.com wrote:

Hi devs,

I need to export and import part of the Org. Tree that we have in PSI (we need to move one country from one server to other). To get the sub org.unit tree, I am using the following REST command

https://dev.psi-mis.org/api/organisationUnits/NxKJFhKFGbN.xml?includeDescendants=true

Where the UID represents the country.

Unfortunately when I try to import the xml file the system gives me an error (see the code below). We are using the 2.16 version, but when I tried the same import in the 2.17 I got that error as well. However, it seems to work fine exporting and importing json files (instead of xml ones), unfortunately we don´t have json metadata import functionality in the 2.16. Could you take a look please? (It is a bit urgent for us) Many thanks!

  • INFO 2014-12-24 12:54:51,927 [Level: INFO, category: METADATA_IMPORT, time: W

ed Dec 24 12:54:51 CET 2014, message: Importing 793 OrganisationUnits] (InMemory

Notifier.java [taskScheduler-1])

  • ERROR 2014-12-24 12:54:51,997 Unexpected error occurred in scheduled task. (Ta

skUtils.java [taskScheduler-1])

java.lang.NullPointerException

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extractAttributeValues(DefaultIdentifiableObjectImport

er.java:297)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er$NonIdentifiableObjects.extract(DefaultIdentifiableObjectImporter.java:169)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.updateObject(DefaultIdentifiableObjectImporter.java:685)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.startImport(DefaultIdentifiableObjectImporter.java:851)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjectLocal(DefaultIdentifiableObjectImporter.java:817)

at org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport

er.importObjects(DefaultIdentifiableObjectImporter.java:775)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo

rtService.java:261)

at org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau

ltImportService.java:178)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

sorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti

on(AopUtils.java:317)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo

inpoint(ReflectiveMethodInvocation.java:183)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:150)

at org.springframework.transaction.interceptor.TransactionInterceptor$1.

proceedWithInvocation(TransactionInterceptor.java:96)

at org.springframework.transaction.interceptor.TransactionAspectSupport.

invokeWithinTransaction(TransactionAspectSupport.java:260)

at org.springframework.transaction.interceptor.TransactionInterceptor.in

voke(TransactionInterceptor.java:94)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(

ReflectiveMethodInvocation.java:172)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami

cAopProxy.java:204)

at com.sun.proxy.$Proxy282.importMetaData(Unknown Source)

at org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM

etaDataTask.java:93)

at org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl

e.run(DelegatingErrorHandlingRunnable.java:53)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

access$201(ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.

run(ScheduledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.

java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

.java:615)

at java.lang.Thread.run(Thread.java:744)


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