← Back to team overview

dhis2-devs team mailing list archive

Re: [Bug 1483215] Re: Exception while Importing Meta Data

 

Hi

This is not an ideal solution, but could you take your XML file and find
all category/options with name "default" and remove them? hopefully it
should work after that, we did fix a bug similar to this a few weeks ago..
but I'm hearing some people still have issues with it, so I will have
another look

--
Morten

On Thu, Oct 8, 2015 at 6:32 AM, Furqonuddin Ramdhani <furqon17@xxxxxxxxx>
wrote:

> Hi All,
>
> is this bug already solved ? I still have this problem when importing my
> metadata from version 2.19 to 2.20,
>
>  ERROR 2015-10-08 06:07:57,109 ERROR: duplicate key value violates unique
> constraint "uk_pbj3u1nk9vnuof8f47utvowmv"
>   Detail: Key (name)=(default) already exists. (SqlExceptionHelper.java
> [taskScheduler-2])
> * ERROR 2015-10-08 06:07:57,111 Unexpected error occurred in scheduled
> task. (TaskUtils.java [taskScheduler-2])
> org.springframework.dao.DataIntegrityViolationException: could not execute
> statement; SQL [n/a]; constraint [uk_pbj3u1nk9vnuof8f47utvowmv]; nested
> exception is org.hibernate.exception.ConstraintViolationException: could
> not execute statement
>
> any suggestion ?
>
> Thanks
>
> On Fri, Sep 18, 2015 at 3:21 PM, jason.p.pickering <
> 1483215@xxxxxxxxxxxxxxxxxx> wrote:
>
>> ** 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/1483215
>>
>> Title:
>>   Exception while Importing Meta Data
>>
>> Status in DHIS:
>>   Fix Released
>>
>> Bug description:
>>   Hi,
>>
>>   Created a new Database with 5 Category Options, 2 Categories and 1
>>   Category Combination, 1 data element, 2 dataset and 2 organisation
>>   units.
>>
>>   Exported meta data with Import/Export App by selecting all
>>   options(default selection) and got metadata.xml (zip file) and created
>>   a fresh instance with empty database and tried to import the metadata
>>   zip file to that and found following Exception.
>>
>>
>>   * INFO  2015-08-10 16:36:44,952 User 'admin' started import at Mon Aug
>> 10 16:36:
>>   44 IST 2015 (DefaultImportService.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:44,954 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:44 IST 2015, message: Importing meta-data]
>> (InMemoryNotifier.jav
>>   a [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:44,958 Building object-bridge maps
>> (preheatCache: true)
>>   . (DefaultObjectBridge.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,170 Building object-bridge maps took 0.22
>> seconds. (
>>   DefaultObjectBridge.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,170 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 2 OrganisationUnits]
>> (InMemoryNo
>>   tifier.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,186 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 2
>> OrganisationUnitLevels] (InMem
>>   oryNotifier.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,201 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 6 CategoryOptions]
>> (InMemoryNoti
>>   fier.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,201 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 3 Categories]
>> (InMemoryNotifier.
>>   java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,201 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 2 CategoryCombos]
>> (InMemoryNotif
>>   ier.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,217 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 7 CategoryOptionCombos]
>> (InMemor
>>   yNotifier.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,218 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 1 DataElements]
>> (InMemoryNotifie
>>   r.java [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,218 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 1 Users]
>> (InMemoryNotifier.java
>>   [taskScheduler-1])
>>   * INFO  2015-08-10 16:36:45,218 [Level: INFO, category:
>> METADATA_IMPORT, time: M
>>   on Aug 10 16:36:45 IST 2015, message: Importing 1 DataSets]
>> (InMemoryNotifier.ja
>>   va [taskScheduler-1])
>>   * WARN  2015-08-10 16:36:45,265 SQL Error: 0, SQLState: 23505
>> (SqlExceptionHelpe
>>   r.java [taskScheduler-1])
>>   * ERROR 2015-08-10 16:36:45,265 ERROR: duplicate key value violates
>> unique const
>>   raint "uk_pbj3u1nk9vnuof8f47utvowmv"
>>     Detail: Key (name)=(default) already exists. (SqlExceptionHelper.java
>> [taskSch
>>   eduler-1])
>>   * ERROR 2015-08-10 16:36:45,265 Unexpected error occurred in scheduled
>> task. (Ta
>>   skUtils.java [taskScheduler-1])
>>   org.hibernate.exception.ConstraintViolationException: could not execute
>> statemen
>>   t
>>           at
>> org.hibernate.exception.internal.SQLStateConversionDelegate.convert(S
>>   QLStateConversionDelegate.java:129)
>>           at
>> org.hibernate.exception.internal.StandardSQLExceptionConverter.conver
>>   t(StandardSQLExceptionConverter.java:49)
>>           at
>> org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlException
>>   Helper.java:124)
>>           at
>> org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlException
>>   Helper.java:109)
>>           at
>> org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(
>>   ResultSetReturnImpl.java:189)
>>           at
>> org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(
>>   NonBatchingBatch.java:59)
>>           at
>> org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
>>   tEntityPersister.java:3079)
>>           at
>> org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
>>   tEntityPersister.java:3521)
>>           at
>> org.hibernate.action.internal.EntityInsertAction.execute(EntityInsert
>>   Action.java:88)
>>           at
>> org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
>>           at
>> org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:
>>   387)
>>           at
>> org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:
>>   303)
>>           at
>> org.hibernate.event.internal.AbstractFlushingEventListener.performExe
>>   cutions(AbstractFlushingEventListener.java:349)
>>           at
>> org.hibernate.event.internal.DefaultFlushEventListener.onFlush(Defaul
>>   tFlushEventListener.java:56)
>>           at
>> org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)
>>           at
>> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport
>>
>> er$NonIdentifiableObjects.saveDataElementOperands(DefaultIdentifiableObjectImpor
>>   ter.java:1164)
>>           at
>> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport
>>
>> er$NonIdentifiableObjects.save(DefaultIdentifiableObjectImporter.java:981)
>>           at
>> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport
>>   er.newObject(DefaultIdentifiableObjectImporter.java:362)
>>           at
>> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport
>>   er.startImport(DefaultIdentifiableObjectImporter.java:556)
>>           at
>> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport
>>   er.importObjectLocal(DefaultIdentifiableObjectImporter.java:511)
>>           at
>> org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImport
>>   er.importObjects(DefaultIdentifiableObjectImporter.java:187)
>>           at
>> org.hisp.dhis.dxf2.metadata.DefaultImportService.doImport(DefaultImpo
>>   rtService.java:264)
>>           at
>> org.hisp.dhis.dxf2.metadata.DefaultImportService.importMetaData(Defau
>>   ltImportService.java:181)
>>           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:601)
>>           at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
>>   on(AopUtils.java:317)
>>           at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
>>   inpoint(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.in
>>   voke(TransactionInterceptor.java:96)
>>           at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
>>   ReflectiveMethodInvocation.java:179)
>>           at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
>>   cAopProxy.java:207)
>>           at $Proxy319.importMetaData(Unknown Source)
>>           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:601)
>>           at
>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
>>   on(AopUtils.java:317)
>>           at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo
>>   inpoint(ReflectiveMethodInvocation.java:190)
>>           at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
>>   ReflectiveMethodInvocation.java:157)
>>           at
>> org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
>>   roceed(DelegatingIntroductionInterceptor.java:133)
>>           at
>> org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
>>   oke(DelegatingIntroductionInterceptor.java:121)
>>           at
>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
>>   ReflectiveMethodInvocation.java:179)
>>           at
>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
>>   cAopProxy.java:207)
>>           at $Proxy275.importMetaData(Unknown Source)
>>           at
>> org.hisp.dhis.importexport.action.util.ImportMetaDataTask.run(ImportM
>>   etaDataTask.java:97)
>>           at
>> org.springframework.scheduling.support.DelegatingErrorHandlingRunnabl
>>   e.run(DelegatingErrorHandlingRunnable.java:54)
>>           at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
>>   1)
>>           at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>           at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>           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:1110)
>>           at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>>   .java:603)
>>           at java.lang.Thread.run(Thread.java:722)
>>   Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key
>> value violate
>>   s unique constraint "uk_pbj3u1nk9vnuof8f47utvowmv"
>>     Detail: Key (name)=(default) already exists.
>>           at
>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryEx
>>   ecutorImpl.java:2198)
>>           at
>> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutor
>>   Impl.java:1927)
>>           at
>> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.ja
>>   va:255)
>>           at
>> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stat
>>   ement.java:561)
>>           at
>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(Abstract
>>   Jdbc2Statement.java:419)
>>           at
>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdb
>>   c2Statement.java:365)
>>           at
>> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewP
>>   roxyPreparedStatement.java:105)
>>           at
>> org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(
>>   ResultSetReturnImpl.java:186)
>>           ... 53 more
>>
>>
>>   Please help.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/dhis2/+bug/1483215/+subscriptions
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
>
> --
> Best Regards,
> *Furqonuddin Ramdhani*
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References