Hibernate error at startup : [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov [FIXED]

the below picture showed when I try to run the dhis2 system

the log of catalina I will add it in reply part of this post. please find it

Please check that the Postgresql database server is running :slight_smile:

it’s running
dhis2@yhmis:/$ sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2023-06-30 14:09:00 +03; 2h 47min ago
Main PID: 997 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 9088)
Memory: 0B
CGroup: /system.slice/postgresql.service

Jun 30 14:09:00 yhmis systemd[1]: Starting PostgreSQL RDBMS…
Jun 30 14:09:00 yhmis systemd[1]: Finished PostgreSQL RDBMS.

when I run the cataline before startup tomcat there are many of messages I would like to share them with you:

2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@21fe2be3]) and a value of type [org.hibernate.boot.internal.MetadataImpl] (value [org.hibernate.boot.internal.MetadataImpl@1f6075ca]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@cb31145]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@2bd79ac9]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@cb31145]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@48387cd7]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@cb31145]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@6a3e3223]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@cb31145]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@4d4acc17]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@cb31145]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@4d08af30]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@cb31145]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@465dac82]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
<6>Deployment of web application archive [/home/dhis/tomcat-dhis/webapps/ROOT.war] has finished in [26,368] ms
<6>Starting ProtocolHandler [“http-nio-8081”]
<6>Server startup in [26,409] milliseconds

I forget to say that, this broken in system happen when I upgrade it from 2.35.1 to 2.39.2

in addition I would like to share you catalina log when I startuped up the server:
dhis2@yhmis:/$ sudo -u dhis /home/dhis/tomcat-dhis/bin/startup.sh
Using CATALINA_BASE: /home/dhis/tomcat-dhis
Using CATALINA_HOME: /usr/share/tomcat9
Using CATALINA_TMPDIR: /home/dhis/tomcat-dhis/temp
Using JRE_HOME: /usr/lib/jvm/java-17-openjdk-amd64/
Using CLASSPATH: /usr/share/tomcat9/bin/bootstrap.jar:/usr/share/tomcat9/bin/tomcat-juli.jar
Tomcat started.
Tomcat started
dhis2@yhmis:/$ sudo tail -f /home/dhis/tomcat-dhis/logs/catalina.out
<6>Command line argument: -Djava.io.tmpdir=/home/dhis/tomcat-dhis/temp
<6>Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.6.5].
<6>APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
<6>APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
<6>OpenSSL successfully initialized [OpenSSL 1.1.1f 31 Mar 2020]
<6>Initializing ProtocolHandler [“http-nio-8081”]
<6>Server initialization in [272] milliseconds
<6>Starting service [Catalina]
<6>Starting Servlet engine: [Apache Tomcat/9.0.31 (Ubuntu)]
<6>Deploying web application archive [/home/dhis/tomcat-dhis/webapps/ROOT.war]
<6>At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

  • INFO 2023-06-30T17:02:17,766 Context variable dhis2-home not set (LogOnceLogger.java [main])
  • INFO 2023-06-30T17:02:17,772 System property dhis2.home not set (LogOnceLogger.java [main])
  • INFO 2023-06-30T17:02:17,772 Environment variable DHIS2_HOME points to /home/dhis/config (LogOnceLogger.java [main])
  • INFO 2023-06-30T17:02:17,796 File /home/dhis/config/dhis-google-auth.json does not exist (LogOnceLogger.java [main])
  • INFO 2023-06-30T17:02:17,797 Could not find dhis-google-auth.json (LogOnceLogger.java [main])
  • INFO 2023-06-30T17:02:19,160 Monitoring metric for key monitoring.cpu.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2023-06-30T17:02:19,162 Monitoring metric for key monitoring.hibernate.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2023-06-30T17:02:19,164 Monitoring metric for key monitoring.uptime.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2023-06-30T17:02:19,166 Monitoring metric for key monitoring.jvm.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2023-06-30T17:02:19,168 Monitoring metric for key monitoring.dbpool.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2023-06-30T17:02:19,178 Monitoring metric for key monitoring.api.enabled is disabled (MetricsEnabler.java [main])
  • INFO 2023-06-30T17:02:21,189 Hibernate configuration loaded: dialect: ‘org.hisp.dhis.hibernate.dialect.DhisPostgresDialect’, region factory: ‘org.hibernate.cache.ehcache.EhCacheRegionFactory’, connection pool max size: null (DefaultHibernateConfigurationProvider.java [main])
  • INFO 2023-06-30T17:02:23,376 Simple Local Cache instance created for region:‘periodCache’ (SimpleCacheBuilder.java [main])
  • INFO 2023-06-30T17:02:30,076 DHIS 2 Version: 2.39.2, Revision: 3b1d35d, Build date: Wed Jun 07 14:36:55 AST 2023, Database name: dhis2, Java version: 17.0.7 (DefaultSystemService.java [main])
  • INFO 2023-06-30T17:02:30,822 File store configured with provider: ‘filesystem’, container: ‘files’ and location: ‘’. (JCloudsFileResourceContentStore.java [main])
  • INFO 2023-06-30T17:02:32,616 File store configured with provider: ‘filesystem’, container: ‘files’ and location: ‘’. (JCloudsAppStorageService.java [main])
  • INFO 2023-06-30T17:02:32,617 Old apps folder does not exist, stopping discovery (LocalAppStorageService.java [main])
  • INFO 2023-06-30T17:02:32,618 Starting JClouds discovery (JCloudsAppStorageService.java [main])
  • INFO 2023-06-30T17:02:32,622 No apps found during JClouds discovery. (JCloudsAppStorageService.java [main])
  • INFO 2023-06-30T17:02:33,022 Initialized NoOp leader manager with node UUID: ‘636a88fe-86f3-49f8-b73b-ff2ed0f3c9f7’ and node ID: ‘’ (NoOpLeaderManager.java [main])
  • INFO 2023-06-30T17:02:33,260 Scheduled monitoring service (DefaultMonitoringService.java [main])
  • INFO 2023-06-30T17:02:33,767 Following listeners are registered: [org.hisp.dhis.sms.listener.TrackedEntityRegistrationSMSListener@76f87e3b, org.hisp.dhis.sms.listener.EnrollmentSMSListener@2991b36c, org.hisp.dhis.sms.listener.UnregisteredSMSListener@4d4f55d5, org.hisp.dhis.sms.listener.DataValueSMSListener@65d1cc9c, org.hisp.dhis.sms.listener.TrackerEventSMSListener@ebf029c, org.hisp.dhis.sms.listener.RelationshipSMSListener@5aeb0b7d, org.hisp.dhis.sms.listener.SingleEventListener@6eb50379, org.hisp.dhis.sms.listener.DhisMessageAlertListener@22c8d445, org.hisp.dhis.sms.listener.J2MEDataValueSMSListener@c6f970b, org.hisp.dhis.sms.listener.DeleteEventSMSListener@3ae01f5c, org.hisp.dhis.sms.listener.AggregateDataSetSMSListener@19c22fdb, org.hisp.dhis.sms.listener.SimpleEventSMSListener@569b55c2, org.hisp.dhis.sms.listener.ProgramStageDataEntrySMSListener@5618d7c] (SmsConsumerThread.java [main])
  • INFO 2023-06-30T17:02:33,792 SMS consumer started (DefaultSmsConsumerService.java [main])
  • INFO 2023-06-30T17:02:34,126 Starting embedded Artemis ActiveMQ server. (ArtemisManager.java [main])
  • INFO 2023-06-30T17:02:34,485 Initializing Log4j, max file size: ‘100MB’, max file archives: 1 (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,502 Added logger: org.hisp.dhis.resourcetable using file: /home/dhis/config/logs/dhis-analytics-table.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,502 Added logger: org.hisp.dhis.analytics.table using file: /home/dhis/config/logs/dhis-analytics-table.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,503 Added logger: org.hisp.dhis.dxf2 using file: /home/dhis/config/logs/dhis-data-exchange.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,503 Added logger: org.hisp.dhis.dxf2.sync using file: /home/dhis/config/logs/dhis-data-sync.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,504 Added logger: org.hisp.dhis.dxf2.metadata using file: /home/dhis/config/logs/dhis-metadata-sync.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,504 Added logger: org.hisp.dhis.pushanalysis using file: /home/dhis/config/logs/dhis-push-analysis.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,510 Added logger: org.hisp.dhis.audit using file: /home/dhis/config/logs/dhis-audit.log (Log4JLogConfigInitializer.java [main])
  • INFO 2023-06-30T17:02:34,510 Added root logger using file: /home/dhis/config/logs/dhis.log (Log4JLogConfigInitializer.java [main])
  • WARN 2023-06-30T17:02:35,756 You are asking Spring Security to ignore Ant [pattern=‘/api/staticContent/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,757 You are asking Spring Security to ignore Ant [pattern=‘/dhis-web-commons/oidc/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,757 You are asking Spring Security to ignore Ant [pattern=‘/dhis-web-commons/javascripts/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,757 You are asking Spring Security to ignore Ant [pattern=‘/dhis-web-commons/css/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,758 You are asking Spring Security to ignore Ant [pattern=‘/dhis-web-commons/flags/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,758 You are asking Spring Security to ignore Ant [pattern=‘/dhis-web-commons/fonts/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,758 You are asking Spring Security to ignore Ant [pattern=‘/api/files/style/external’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,758 You are asking Spring Security to ignore Ant [pattern=‘/external-static/**’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,758 You are asking Spring Security to ignore Ant [pattern=‘/favicon.ico’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • WARN 2023-06-30T17:02:35,758 You are asking Spring Security to ignore Ant [pattern=‘/api/ping’]. This is not recommended – please use permitAll via HttpSecurity#authorizeHttpRequests instead. (WebSecurity.java [main])
  • INFO 2023-06-30T17:02:36,706 No Gateway configuration found (DefaultGatewayAdministrationService.java [main])
  • INFO 2023-06-30T17:02:36,712 Executing startup routine [1 of 8, runlevel 2]: defaultAdminUserPopulator (DefaultStartupRoutineExecutor.java [main])
  • INFO 2023-06-30T17:02:36,721 Executing startup routine [2 of 8, runlevel 3]: PeriodTypePopulator (DefaultStartupRoutineExecutor.java [main])
  • ERROR 2023-06-30T17:02:36,731 javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object [id=383728] was not of the specified subclass [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
    at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1626)
    at org.hibernate.query.Query.getResultList(Query.java:165)
    at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:76)
    at org.hisp.dhis.period.hibernate.HibernatePeriodStore.getAllPeriodTypes(HibernatePeriodStore.java:259)
    at org.hisp.dhis.period.PeriodTypePopulator.executeInTransaction(PeriodTypePopulator.java:76)
    at org.hisp.dhis.system.startup.TransactionContextStartupRoutine$1.doInTransaction(TransactionContextStartupRoutine.java:57)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
    at org.hisp.dhis.system.startup.TransactionContextStartupRoutine.execute(TransactionContextStartupRoutine.java:52)
    at org.hisp.dhis.system.startup.DefaultStartupRoutineExecutor.execute(DefaultStartupRoutineExecutor.java:113)
    at org.hisp.dhis.system.startup.DefaultStartupRoutineExecutor.execute(DefaultStartupRoutineExecutor.java:70)
    at org.hisp.dhis.system.startup.StartupListener.contextInitialized(StartupListener.java:70)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4683)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5146)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1848)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1575)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
    Caused by: org.hibernate.WrongClassException: Object [id=383728] was not of the specified subclass [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov
    at org.hibernate.loader.Loader.getInstanceClass(Loader.java:1963)
    at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1732)
    at org.hibernate.loader.Loader.getRow(Loader.java:1624)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748)
    at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:998)
    at org.hibernate.loader.Loader.doQuery(Loader.java:967)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:357)
    at org.hibernate.loader.Loader.doList(Loader.java:2868)
    at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2712)
    at org.hibernate.loader.Loader.list(Loader.java:2674)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:540)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:400)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:218)
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1459)
    at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1649)
    at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1617)
    … 51 more
    (StartupListener.java [main])
    <2>One or more listeners failed to start. Full details will be found in the appropriate container log file
    <2>Context [] startup failed due to previous errors
  • INFO 2023-06-30T17:02:36,736 De-registering jdbc driver: org.postgresql.Driver@4322320d (StartupListener.java [main])
    <4>The web application [ROOT] appears to have started a thread named [Log4j2-TF-7-Scheduled-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@17.0.7/jdk.internal.misc.Unsafe.park(Native Method)
    java.base@17.0.7/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
    java.base@17.0.7/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
    java.base@17.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
    java.base@17.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
    <4>The web application [ROOT] appears to have started a thread named [Thread-0 (ActiveMQ-client-global-threads)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@17.0.7/jdk.internal.misc.Unsafe.park(Native Method)
    java.base@17.0.7/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
    java.base@17.0.7/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
    java.base@17.0.7/java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:460)
    org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor$ThreadPoolQueue.poll(ActiveMQThreadPoolExecutor.java:112)
    org.apache.activemq.artemis.utils.ActiveMQThreadPoolExecutor$ThreadPoolQueue.poll(ActiveMQThreadPoolExecutor.java:45)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1061)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
    <4>The web application [ROOT] appears to have started a thread named [cache2k-scheduler] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@17.0.7/jdk.internal.misc.Unsafe.park(Native Method)
    java.base@17.0.7/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
    java.base@17.0.7/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
    java.base@17.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
    java.base@17.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122)
    java.base@17.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
    <4>Failed to clear soft references from ObjectStreamClass$Caches for web application [ROOT]
    <4>java.lang.ClassCastException: class java.io.ObjectStreamClass$Caches$1 cannot be cast to class java.util.Map (java.io.ObjectStreamClass$Caches$1 and java.util.Map are in module java.base of loader ‘bootstrap’)
    <4> at org.apache.catalina.loader.WebappClassLoaderBase.clearCache(WebappClassLoaderBase.java:2269)
    <4> at org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches(WebappClassLoaderBase.java:2256)
    <4> at org.apache.catalina.loader.WebappClassLoaderBase.clearReferences(WebappClassLoaderBase.java:1627)
    <4> at org.apache.catalina.loader.WebappClassLoaderBase.stop(WebappClassLoaderBase.java:1555)
    <4> at org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:443)
    <4> at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
    <4> at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5432)
    <4> at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
    <4> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
    <4> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
    <4> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
    <4> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
    <4> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
    <4> at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1848)
    <4> at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    <4> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    <4> at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    <4> at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
    <4> at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
    <4> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
    <4> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1575)
    <4> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
    <4> at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    <4> at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
    <4> at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
    <4> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
    <4> at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    <4> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <4> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    <4> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    <4> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    <4> at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    <4> at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    <4> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    <4> at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    <4> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <4> at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    <4> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <4> at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    <4> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <4> at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
    <4> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    <4> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    <4> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    <4> at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    <4> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
    <4> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
    <4>
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@32458ded]) and a value of type [org.springframework.security.core.context.ThreadLocalSecurityContextHolderStrategy$$Lambda$1146/0x0000000801f6e658] (value [org.springframework.security.core.context.ThreadLocalSecurityContextHolderStrategy$$Lambda$1146/0x0000000801f6e658@7f5d27a8]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@3b340dcf]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@2ff70bac]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@3143d15a]) and a value of type [org.hibernate.boot.internal.MetadataImpl] (value [org.hibernate.boot.internal.MetadataImpl@2735d0bd]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@2bc93da8]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@5243497f]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@15887cc2]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@c7a4348]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@6cbcd989]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@247c6dd0]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <2>The web application [ROOT] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@3c74fbe1]) and a value of type [org.apache.activemq.artemis.utils.actors.HandlerBase.Counter] (value [org.apache.activemq.artemis.utils.actors.HandlerBase$Counter@72c47bf1]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
    <6>Deployment of web application archive [/home/dhis/tomcat-dhis/webapps/ROOT.war] has finished in [26,054] ms
    <6>Starting ProtocolHandler [“http-nio-8081”]
    <6>Server startup in [26,099] milliseconds

@Gassim Could you help me solve this issue? Feel free to have access to my device via TeamViewer or any other app.

I’m hitting a similar issue QuarterlyNov is coming from the periodType
and it has appeared with this commit : feat: QuarterlyNovember period type (#13256) · dhis2/dhis2-core@d0670a2 · GitHub

select * from periodtype;
┌──────────────┬─────────────────┐
│ periodtypeid │      name       │
├──────────────┼─────────────────┤
│ 3            │ Daily           │
│ 4            │ Weekly          │
│ 5            │ WeeklyWednesday │
│ 6            │ WeeklyThursday  │
│ 7            │ WeeklySaturday  │
│ 8            │ WeeklySunday    │
│ 9            │ BiWeekly        │
│ 10           │ Monthly         │
│ 11           │ BiMonthly       │
│ 12           │ Quarterly       │
│ 13           │ SixMonthly      │
│ 14           │ SixMonthlyApril │
│ 15           │ SixMonthlyNov   │
│ 16           │ Yearly          │
│ 17           │ FinancialApril  │
│ 18           │ FinancialJuly   │
│ 19           │ FinancialOct    │
│ 20           │ FinancialNov    │
│ 83907        │ QuarterlyNov    │
│ SELECT 19    │                 │
└──────────────┴─────────────────┘
(20 rows)
Time: 0.029s

but loading it via the ORM seem to fails

SEVERE: Exception sending context initialized event to listener instance of class [org.hisp.dhis.system.startup.StartupListener]
java.lang.RuntimeException: Failed to run startup routines: org.hibernate.WrongClassException: Object [id=83907] was not of the specified subclass [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov
	at org.hisp.dhis.system.startup.StartupListener.contextInitialized(StartupListener.java:76)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4697)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5165)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object [id=83907] was not of the specified subclass [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov
	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1626)
	at org.hibernate.query.Query.getResultList(Query.java:165)
	at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:76)
	at org.hisp.dhis.period.hibernate.HibernatePeriodStore.getAllPeriodTypes(HibernatePeriodStore.java:259)
	at org.hisp.dhis.period.PeriodTypePopulator.executeInTransaction(PeriodTypePopulator.java:76)
	at org.hisp.dhis.system.startup.TransactionContextStartupRoutine$1.doInTransaction(TransactionContextStartupRoutine.java:57)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at org.hisp.dhis.system.startup.TransactionContextStartupRoutine.execute(TransactionContextStartupRoutine.java:52)
	at org.hisp.dhis.system.startup.DefaultStartupRoutineExecutor.execute(DefaultStartupRoutineExecutor.java:113)
	at org.hisp.dhis.system.startup.DefaultStartupRoutineExecutor.execute(DefaultStartupRoutineExecutor.java:70)
	at org.hisp.dhis.system.startup.StartupListener.contextInitialized(StartupListener.java:70)
	... 9 more
Caused by: org.hibernate.WrongClassException: Object [id=83907] was not of the specified subclass [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov
	at org.hibernate.loader.Loader.getInstanceClass(Loader.java:1963)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1732)
	at org.hibernate.loader.Loader.getRow(Loader.java:1624)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748)
	at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047)
	at org.hibernate.loader.Loader.processResultSet(Loader.java:998)
	at org.hibernate.loader.Loader.doQuery(Loader.java:967)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:357)
	at org.hibernate.loader.Loader.doList(Loader.java:2868)
	at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2712)
	at org.hibernate.loader.Loader.list(Loader.java:2674)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:540)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:400)
	at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:219)
	at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1459)
	at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1649)
	at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1617)

Is it possible that the period type was added then removed ?

So I downloaded the war file, unzipped the necessary jars


 wget https://releases.dhis2.org/2.39/dhis2-stable-2.39.2.1.war
 unzip dhis2-stable-2.39.2.1.war
 cd WEB-INF/lib/
 unzip dhis-service-core-2.39*.jar
 cat org/hisp/dhis/period/hibernate/PeriodType.hbm.xml

this hibernate mapping file doesn’t contains the “QuarterlyNov” entry compared to the main branch

So I assume the code has been “retracted” from the code base
forgetting that a db record could have been created by a previous version of dhis2 ?

So the 2.38.4.3 contains the QuarterlyNov but apparently not 2.39.*

@Gassim can you ping the development team ?

1 Like

created an issue here : [DHIS2-15531] - Jira

in the meantime, I’ve deleted the record from periodtype table and it looks “okish”.
but I don’t know if it was a good idea

@Stephan_Mestach @Gassim good morning. Could you please help me overcome this issue? I appreciate your time and efforts. I want help and a fast solution.

I’m not a dhis2 developer or related to them, I’m just hitting the same problem
So my current workaround is

delete from periodtype where name = 'QuarterlyNov'

but if a dhis2 developer can confirm it’s safe, that would be great
@Gassim can perhaps ask Abyot Asalefew Gizaw to prioritize that ?

3 Likes

Dears,
I am trying to upgrade from the 2.38.4 to the 2.40 War file and my OS is Linux 22.04 LTS. Please find the attached file showing the Tomcat
2.38.4-2.39_Error-log.json (32.1 KB)
log.

Finally fix the problem and the solution I used is in the link below:

1 Like

@Gerald_Thomas excuse me, where is the link. I couldn’t see it.

Apologies for the confusion @sami.oracle10g, the link refered to this page but the topic post was moved here because it’s the same issue. I believe @Gerald_Thomas meant the suggestions provided by @Stephan_Mestach .

Thanks!

1 Like

Interestingly this period type is associated to the ethiopian calendar

@Gassim Does it mean the support of the calendar “disappeared” in newer version ?

(We are investigating this calendar support for one of our project)

Hello everyone,

This is a bug that was tracked and tackled here: [DHIS2-15531] - Jira so an upgrade to the latest patch should fix it (2.39.3 in this case - check release notes)

Does it mean the support of the calendar “disappeared” in newer version ?

@Stephan_Mestach - no it didn’t disappear, it’s still the same status as before (this bug aside) and we’re working on supporting the other unsupported applications for the next major release (import/export, tracker etc…)

2 Likes

@sami.oracle10g Didi you Get the solution for this, if Yes, how did you solve because i encounter the same challenge

this is currently the solution Hibernate error at startup : [org.hisp.dhis.period.PeriodType] : Discriminator: QuarterlyNov [FIXED] - #12 by Stephan_Mestach

1 Like