← Back to team overview

dhis2-users team mailing list archive

Re: Getting exception when opening Tracker Capture

 

Hi Paulo,

I suggest that you first clean it so that you have only unique versionkey
values, then run these SQL statement to ensure that this problem does not
come back:


ALTER TABLE version ALTER COLUMN versionkey SET NOT NULL;
ALTER TABLE version ADD CONSTRAINT version_versionkey_key
UNIQUE(versionkey);


I have also included this in the application startup routine.

regards,

Lars

On Sun, Apr 26, 2015 at 1:11 PM, Paulo Grácio <paulogracio@xxxxxxxxx> wrote:

> postgres=# \c dhis2
> You are now connected to database "dhis2" as user "postgres".
> dhis2=# select * from version;
>  versionid |    versionkey    |             versionvalue
> -----------+------------------+--------------------------------------
>         69 | organisationUnit | 1d366d70-3f79-49d1-9cb0-ab2959445f86
>         70 | organisationUnit | 562762ec-cee7-43aa-b29d-19ad52afb53a
> (2 rows)
>
> /Paulo Grácio
>
>
> On 26 April 2015 at 03:38, Morten Olav Hansen <mortenoh@xxxxxxxxx> wrote:
>
>> Ok, can you just verify that there are two rows in your version table?
>>
>> --
>> Morten
>>
>> On Sat, Apr 25, 2015 at 8:29 PM, Paulo Grácio <paulogracio@xxxxxxxxx>
>> wrote:
>>
>>> Hi Morten,
>>>
>>> no metadata was created or imported. It's a complete clean installation
>>> that if you want you can easily try with Docker.
>>>
>>> https://github.com/pgracio/dhis2-docker
>>>
>>> Regards,
>>> Paulo
>>>
>>>
>>> On 25 April 2015 at 13:47, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>>> wrote:
>>>
>>>> How did you create the metadata, did you use any kind of import
>>>> mechanism? I have seen this before, but haven't been able to reproduce it.
>>>>
>>>> --
>>>> Morten
>>>>
>>>> On Sat, Apr 25, 2015 at 3:48 PM, Paulo Grácio <paulogracio@xxxxxxxxx>
>>>> wrote:
>>>>
>>>>> Hi Morten,
>>>>>
>>>>> this is a clean installation. shouldn't it be fixed on the application
>>>>> side?
>>>>>
>>>>> /Paulo
>>>>>
>>>>> On 25 April 2015 at 05:29, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> Go to your version table, and remove one (or both) of the entries
>>>>>> with versionkey organisationUnit.
>>>>>>
>>>>>> --
>>>>>> Morten
>>>>>>
>>>>>> On Sat, Apr 25, 2015 at 12:03 AM, Paulo Grácio <paulogracio@xxxxxxxxx
>>>>>> > wrote:
>>>>>>
>>>>>>> web_1 | * INFO  2015-04-24 17:00:55,890 Login success for user:
>>>>>>> 'admin', ip: '192.168.59.3' (DefaultUserAuditService.java
>>>>>>> [http-bio-8080-exec-5])
>>>>>>> web_1 | * ERROR 2015-04-24 17:01:22,826 Error while executing action
>>>>>>> (ExceptionInterceptor.java [http-bio-8080-exec-4])
>>>>>>> web_1 | org.hibernate.NonUniqueResultException: query did not return
>>>>>>> a unique result: 2
>>>>>>> web_1 |     at
>>>>>>> org.hibernate.internal.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:914)
>>>>>>> web_1 |     at
>>>>>>> org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
>>>>>>> web_1 |     at
>>>>>>> org.hisp.dhis.version.hibernate.HibernateVersionStore.getVersionByKey(HibernateVersionStore.java:43)
>>>>>>> web_1 |     at
>>>>>>> org.hisp.dhis.version.DefaultVersionService.getVersionByKey(DefaultVersionService.java:108)
>>>>>>> web_1 |     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>>> Method)
>>>>>>> web_1 |     at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>>>>>> web_1 |     at
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>>>>>> web_1 |     at java.lang.reflect.Method.invoke(Method.java:606)
>>>>>>> web_1 |     at
>>>>>>> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>>>>>>> web_1 |     at
>>>>>>> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
>>>>>>> web_1 |     at
>>>>>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>>>>>>> web_1 |     at
>>>>>>> org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
>>>>>>> web_1 |     at
>>>>>>> org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Paulo Grácio
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>>>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Paulo Grácio
>>>>>
>>>>
>>
>
>
> --
> Paulo Grácio
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References