404 when starting DHIS2

My

  • os is ubuntu 20.04
  • tomcat is tomcat9
  • dhis is dhis 2.36

My dhis was running till yesterday. When i tried to run it today (19/Sep) then i got 404 error message.

I am attaching catalina and localhost logs for 19th Septemberlocalhost_access_log.2021-09-19.txt.doc (1.2 KB)
localhost.2021-09-19.log.doc (111.3 KB)
catalina.2021-09-19.log.doc (27.1 KB)

The problem that i could observe was that the localhost.log contained the following line

Blockquote
SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.scheduling.annotation.ProxyAsyncConfiguration’: Unsatisfied dependency expressed through method ‘setConfigurers’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘databaseInfo’ defined in URL [jar:file:/home/dhis/tomcat-dhis/webapps/ROOT/WEB-INF/lib/dhis-support-system-2.36.0.jar!/org/hisp/dhis/system/database/DatabaseInfoFactoryBean.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘databaseInfoProvider’: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Postgis extension is not installed. Execute “CREATE EXTENSION postgis;” as a superuser and start the application again

Blockquote

Please note that postgis is already installed. I had again installed as
psql -U postgres -d postgres -c “CREATE EXTENSION postgis”
and also psql -U dhis -d dhis2 -c “CREATE EXTENSION postgis”

I also installed postgis_topology

Then stopped and restarted dhis application and finally rebooted the system. Still I am getting same error.

Also please note that in order to upload the files i had to add “doc” extension to all them

Hello @amitta Post GIS is installed, but it looks like the scripts are not available. if they are not, you will usually find errors. what version of PostGIS are you using?
An example if you are using postgres 10

$ sudo apt install postgresql-10-postgis-2.4 
$ sudo apt install postgresql-10-postgis-scripts

Please let us know if you installed the scripts and it is still failing.

1 Like

Dear @moses_mwale My postgres is 13.4. I ran the second line i.e postgis-scripts. But the system said that its a virtual package and to run the following

sudo apt install postgresql-13-postgis-3-scripts

After executing, still getting 404 error. But the error in localhost.2021-09-20 has changed to the following

20-Sep-2021 07:55:55.258 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.hisp.dhis.analytics.event.EventDataQueryService’ defined in URL [jar:file:/home/dhis/tomcat-dhis/webapps/ROOT/WEB-INF/lib/dhis-service-analytics-2.36.0.jar!/org/hisp/dhis/analytics/event/data/DefaultEventDataQueryService.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘defaultQueryItemLocator’ defined in URL [jar:file:/home/dhis/tomcat-dhis/webapps/ROOT/WEB-INF/lib/dhis-service-analytics-2.36.0.jar!/org/hisp/dhis/analytics/event/data/DefaultQueryItemLocator.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.hisp.dhis.trackedentity.TrackedEntityAttributeService’ defined in URL [jar:file:/home/dhis/tomcat-dhis/webapps/ROOT/WEB-INF/lib/dhis-service-core-2.36.0.jar!/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.class]: Bean instantiation via constructor failed; nested exception is java.lang.UnsatisfiedLinkError: Can’t load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so

@amitta sorry for the late reply, how far with this issue (Can’t load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so). It looks like the open JDK you loading is not compiled correctly. Are you able to uninstall it and install it again?
A work around would be to use the openjdk-1.8 for test purposes only and see if you still have the issue. if it goes away then the problem is the java 11 which I know it wasnt compiled properly.
Also another workaround If you have open JDK 8 installed, you could do the following to alternate

sudo alternatives --set java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-0.fc33.x86_64/jre/bin/java

This will resolve your problem

@moses_mwale Thanks for giving me insights. I googled for missing libawt_xawt.so. It was suggested that to reinstall java with the following command on Ubuntu

sudo apt install openjdk-11-jdk

after this my DHIS started working.

Thanks for guiding me

Great, it worked, @amitta please select the solution to your problem on the insights shared to help another person who might have the same problem in the future.

Please suggest, where and how to share it. I will do it

There is a solution check box besides every insight I have shared. You just need to click.

:smiley: Thanks!
Under the post after you click on the three dots, you’ll see the solution button!

@Gassim @moses_mwale Marked it as solution

Ahh okay @amitta , but this question has 2 questions and 2 solutions. The first was for the PostGIS scripts and another was for the installation problem. what you @Gassim have marked as a solution is the installation problem. what do we do?

1 Like

@moses_mwale You are right that we did solve two problems. When we solved the firs it uncovered the second. Because in the solution to the first problem, I have written that I am still having the problem. SO, I was not sure that I mark that also a solution.

If you and @Gassim think it proper to mark that (the first one) as a solution, I will do it

1 Like