Emergency! problems for dhis2.32/33: duplicate key value violates unique

2.32.2.33 new install , do analysis. will cause this.

windows, now ubuntu. I don’t know why?
SQL [insert into _dateperiodstructure_temp values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; ERROR: duplicate key value violates unique constraint “_dateperiodstructure_temp_pkey” Detail: Key (dateperiod)=(1988-04-10) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “_dateperiodstructure_temp_pkey” Detail: Key (dateperiod)=(1988-04-10) already exists.

QQ图片20200221160905

QQ图片20200221161029

error found in dhis 2.33 , using demo db from dhis2.org.

env: ubuntu 18, psql -10, tomcat-9, java-8

dhis ver 2.32 have same problem too.

Hi @lin_xd,

could you let us know which calendar you have under Apps > System settings > Calendar?

best,

Lars

iso-8601

I have set postgresql local to zh_CN. its still. you can try at: http://swx.wj120.com.cn:20003/dhis

I am trying 2.33.2 now, hope will dispear. I am collection china new SARS info.
please help. this will cause work stop.

2.33.2 still ,dont’ know why

can work in another : just ubuntu 16.x ,ubuntu 18 not work?

same db(ubuntu 16,ps 10.10) -->ubuntu 16+tomcat8/9 OK, but

for ubuntu 18+tomcat 8/9 || windows server 2008, not ok .

why only this: Key (dateperiod)=(1988-04-10) ??? :grin: :smile:

org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into _dateperiodstructure_temp values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; ERROR: duplicate key value violates unique constraint “_dateperiodstructure_temp_pkey”
ost 细:Key (dateperiod)=(1988-04-10) already exists.; nested exception is org.p
gresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “_dateperiodstructure_temp_pkey”
详细:Key (dateperiod)=(1988-04-10) already exists.
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:242)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1442)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:646)
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:935)
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:989)
at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:980)
at org.hisp.dhis.resourcetable.jdbc.JdbcResourceTableStore.batchUpdate(JdbcResourceTableStore.java:212)
at org.hisp.dhis.resourcetable.jdbc.JdbcResourceTableStore.generateResourceTable(JdbcResourceTableStore.java:137)
at org.hisp.dhis.resourcetable.DefaultResourceTableService.generateDatePeriodTable(DefaultResourceTableService.java:189)
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:343)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:205)
at com.sun.proxy.$Proxy246.generateDatePeriodTable(Unknown Source)
at org.hisp.dhis.analytics.table.DefaultAnalyticsTableGenerator.generateResourceTables(DefaultAnalyticsTableGenerator.java:219)
at org.hisp.dhis.analytics.table.DefaultAnalyticsTableGenerator.generateTables(DefaultAnalyticsTableGenerator.java:127)
at org.hisp.dhis.analytics.table.scheduling.AnalyticsTableJob.execute(AnalyticsTableJob.java:84)
at org.hisp.dhis.scheduling.DefaultJobInstance.executeJob(DefaultJobInstance.java:157)
at org.hisp.dhis.scheduling.DefaultJobInstance.execute(DefaultJobInstance.java:71)
at org.hisp.dhis.scheduling.DefaultSchedulingManager.lambda$internalExecuteJobConfiguration$3(DefaultSchedulingManager.java:293)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “_dateperiodstructure_temp_pkey”
详细:Key (dateperiod)=(1988-04-10) already exists.
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.flushIfDeadlockRisk(QueryExecutorImpl.java:1299)
at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1324)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:467)
at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:840)
at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1538)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2437)
at org.springframework.jdbc.core.JdbcTemplate.lambda$batchUpdate$2(JdbcTemplate.java:949)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:616)
… 30 more

same db under ubuntu 16+pg 10, windows analysis, error! and then using same dhis2 in ubuntu 16, startup and do analysis, it’s ok, then windows do again ,still
error.

HibernateIdentifiableObjectStore.java: 某些输入文件使用了未经检查或不安全的操作。

[INFO] — maven-compiler-plugin:3.8.1:compile (default-compile) @ dhis-service-core —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 498 source files to D:\dhis\dhis223\trunk\core\dhis2-core\dhis-2\dhis-services\dhis-service-core\target\classes
[INFO] /D:/dhis/dhis223/trunk/core/dhis2-core/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/oauth2/DefaultClientDetailsUserDe
tailsService.java: 某些输入文件使用或覆盖了已过时的 API。
[INFO] /D:/dhis/dhis223/trunk/core/dhis2-core/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/security/oauth2/DefaultClientDetailsUserDe
tailsService.java: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
[INFO] /D:/dhis/dhis223/trunk/core/dhis2-core/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObje
ctStore.java: 某些输入文件使用了未经检查或不安全的操作。
[INFO] /D:/dhis/dhis223/trunk/core/dhis2-core/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObje
ctStore.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
[INFO]

I have test diffenert database encoding: all same result
CREATE DATABASE dhis2
WITH OWNER = postgres
ENCODING = ‘UTF8’
TABLESPACE = test
LC_COLLATE = ‘zh_CN.UTF-8’
LC_CTYPE = ‘zh_CN.UTF-8’
CONNECTION LIMIT = -1;

ALTER DATABASE dhis2
SET lc_time = ‘zh_CN.UTF-8’;

CREATE DATABASE dhist
WITH OWNER = postgres
ENCODING = ‘UTF8’
TABLESPACE = test
LC_COLLATE = ‘zh_CN.UTF-8’
LC_CTYPE = ‘zh_CN.UTF-8’
CONNECTION LIMIT = -1;

ALTER DATABASE dhist
SET lc_time = ‘en_US.UTF-8’;

CREATE DATABASE dhist1
WITH OWNER = postgres
ENCODING = ‘UTF8’
TABLESPACE = pg_default
LC_COLLATE = ‘zh_CN.UTF-8’
LC_CTYPE = ‘zh_CN.UTF-8’
CONNECTION LIMIT = -1;


got it ,just jre version.! 1.8.0.127 ok, 1.8.0.>200 may not .
another reson may runing jre lower than compiling jre version.

1 Like