dhis2 Upgrade from 2.28 to 2.31

Hellow every one, hope you’re all doing fine…
we were using DHIS2 of version 2.28 and we’ve upgraded it to version 2.31…
but our metadata are of previous version…
and when i import metadata nothing is imported…
please help me …

Hi Ahly

Can you import your metadata first and then perform the upgrade? This is likely to be more reliable than trying to import an old metadata load into a new version.

Regards
Bob

1 Like

@bobj I am currently experiencing something similar. We have a production instance at ver 2.30 and a new dev instance also at ver 2.30.
I exported the metadata from the production instance in different sections e.g. category options, data elements, indicators, and option sets together. When I try the import, it does not go through and throws a number of errors (see below)

I have gone to the sharing settings for all the category options indicated and removed all the sharing settings for the user groups and left only public.

Have tried to run it again and this time it is not displaying anything. I do not have access to the backend logs to see what is going on.

I have also tried a dry run and it just goes on in an endless loop.

I am not sure what is going on with the sharing settings.

Some insight and guidance would be most appreciated.

@Stian @viet @Lars

1 Like

@bobj @viet @Stian @Lars

Just a follow on to this, Org Units with attributes assigned to them, also do not import.

There is also no way of including the attributes in the metadata export.

2 Likes

Here are the dhis2 logs showing that the issue is with an already existing ‘default’ category option in the database. I am trying to find some documentation where this has been dealt with previously but any help would really be apprecaited

INFO  2019-02-18 16:33:22,587 (admin) Creating 181 object(s) of type CategoryOption (DefaultObjectBundleService.java [taskScheduler-5])
* INFO  2019-02-18 16:33:22,587 [Level: INFO, category: METADATA_IMPORT, time: Mon Feb 18 16:33:22 WAT 2019, message: (admin) Creating 181 object(s) of type CategoryOption] (InMemoryNotifier.java [taskScheduler-5])
* WARN  2019-02-18 16:33:22,744 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [taskScheduler-5])
* ERROR 2019-02-18 16:33:22,745 ERROR: duplicate key value violates unique constraint "uk_qp9201a4m6jl53sei0huh4l6s"
  Detail: Key (shortname)=(default) already exists. (SqlExceptionHelper.java [taskScheduler-5])
* ERROR 2019-02-18 16:33:22,752 Unexpected error occurred in scheduled task. (TaskUtils.java [taskScheduler-5])
javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:149)
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164)
	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1443)
	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1423)
	at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.handleCreates(DefaultObjectBundleService.java:312)
	at org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService.commit(DefaultObjectBundleService.java:181)
	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:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
	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:213)
	at com.sun.proxy.$Proxy203.commit(Unknown Source)
	at org.hisp.dhis.dxf2.metadata.DefaultMetadataImportService.importMetadata(DefaultMetadataImportService.java:137)
	at sun.reflect.GeneratedMethodAccessor1080.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:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
	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:213)
	at com.sun.proxy.$Proxy205.importMetadata(Unknown Source)
	at org.hisp.dhis.webapi.controller.metadata.MetadataAsyncImporter.call(MetadataAsyncImporter.java:76)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112)
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032)
	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3547)
	at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:600)
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:474)
	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1437)
	... 39 more
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "uk_qp9201a4m6jl53sei0huh4l6s"
  Detail: Key (shortname)=(default) already exists.
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2422)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2167)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
	at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:132)
	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:384)
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175)
	... 47 more
1 Like