Issue with start dhis2 application

Dear Sirs,

I am new on dhis2. I have dhis2 with same way which given into Installation - DHIS2 Documentation. Instance was working.
But, now i have removed old instance and created new one which using
sudo tomcat9-instance-create tomcat-dhis
Now instance is not working. All the permission are ok. Could you please help me out.
Here are the attached catlina logs:
+±--------------------------------------------------------------
root@hisp:/home/dhis# sudo tail -f tomcat-hisp/logs/catalina.out
<6>Command line argument: -Dignore.endorsed.dirs=
<6>Command line argument: -Dcatalina.base=/home/dhis/tomcat-hisp
<6>Command line argument: -Dcatalina.home=/usr/share/tomcat9
<6>Command line argument: -Djava.io.tmpdir=/home/dhis/tomcat-hisp/temp
<6>The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
<6>Initializing ProtocolHandler [“http-nio-8080”]
<6>Server initialization in [1,014] milliseconds
<6>Starting service [Catalina]
<6>Starting Servlet engine: [Apache Tomcat/9.0.31 (Ubuntu)]
<6>Deploying web application archive [/home/dhis/tomcat-hisp/webapps/dhis.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 2022-11-24T19:20:20,962 System property dhis2.home not set (LogOnceLogger.java [main])
  • INFO 2022-11-24T19:20:20,987 Environment variable DHIS2_HOME not set (LogOnceLogger.java [main])
  • INFO 2022-11-24T19:20:21,014 Directory /opt/dhis2 cannot be created (LogOnceLogger.java [main])
    <2>Error deploying web application archive [/home/dhis/tomcat-hisp/webapps/dhis.war]
    <2>java.lang.IllegalStateException: Error starting child
    <2> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:720)
    <2> at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
    <2> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
    <2> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
    <2> at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1848)
    <2> at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    <2> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    <2> at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    <2> at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
    <2> at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:772)
    <2> at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
    <2> at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1575)
    <2> at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
    <2> at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    <2> at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
    <2> at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
    <2> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:936)
    <2> at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
    <2> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <2> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    <2> at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    <2> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    <2> at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    <2> at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    <2> at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    <2> at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    <2> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <2> at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    <2> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <2> at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    <2> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <2> at org.apache.catalina.startup.Catalina.start(Catalina.java:633)
    <2> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    <2> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    <2> at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    <2> at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    <2> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
    <2> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
    <2>Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/dhis]]
    <2> at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
    <2> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    <2> at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
    <2> … 37 more
    <2>Caused by: java.lang.IllegalStateException: Properties could not be loaded
    <2> at org.hisp.dhis.external.conf.DefaultDhisConfigurationProvider.loadDhisConf(DefaultDhisConfigurationProvider.java:344)
    <2> at org.hisp.dhis.external.conf.DefaultDhisConfigurationProvider.init(DefaultDhisConfigurationProvider.java:114)
    <2> at org.hisp.dhis.webapi.servlet.DhisWebApiWebAppInitializer.getConfig(DhisWebApiWebAppInitializer.java:119)
    <2> at org.hisp.dhis.webapi.servlet.DhisWebApiWebAppInitializer.onStartup(DhisWebApiWebAppInitializer.java:62)
    <2> at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174)
    <2> at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5135)
    <2> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    <2> … 38 more
    <2>Caused by: org.hisp.dhis.external.location.LocationManagerException: External directory not set
    <2> at org.hisp.dhis.external.location.DefaultLocationManager.buildDirectory(DefaultLocationManager.java:243)
    <2> at org.hisp.dhis.external.location.DefaultLocationManager.getFileForReading(DefaultLocationManager.java:173)
    <2> at org.hisp.dhis.external.location.DefaultLocationManager.getInputStream(DefaultLocationManager.java:146)
    <2> at org.hisp.dhis.external.location.DefaultLocationManager.getInputStream(DefaultLocationManager.java:139)
    <2> at org.hisp.dhis.external.conf.DefaultDhisConfigurationProvider.loadDhisConf(DefaultDhisConfigurationProvider.java:333)
    <2> … 44 more
    <2>
    <6>Deployment of web application archive [/home/dhis/tomcat-hisp/webapps/dhis.war] has finished in [51,111] ms
    <6>Starting ProtocolHandler [“http-nio-8080”]
    <6>Server startup in [51,449] milliseconds

Hi @MohinderS

May be now you are looking at a different log file?

Isn’t your new log files will generated under tomcat-dhis/logs/catalina.out and not tomcat-hisp ?

1 Like

Thanks Jins for your response.
Sorry i had created with command : sudo tomcat9-instance-create tomcat-hisp
Logs files location is correct. I noticed in the logs its saying
+±-------------------------------

  • INFO 2022-11-24T19:20:20,962 System property dhis2.home not set (LogOnceLogger.java [main])
  • INFO 2022-11-24T19:20:20,987 Environment variable DHIS2_HOME not set (LogOnceLogger.java [main])
  • INFO 2022-11-24T19:20:21,014 Directory /opt/dhis2 cannot be created (LogOnceLogger.java [main])
    <2>Error deploying web application archive [/home/dhis/tomcat-hisp/webapps/dhis.war]
    +±-----------------------------------------------

But i am surprise everything is there on their place. You can find the attached screenshot.

Hello Jins,

As per above error. I have copied config file to /opt/dhis2 and add the changes into setenv file.
Now application is fine.

Could you please let me know why it is asking about /opt/dhis2. I mean is there installation process is changed or something.
image

Thanks

2 Likes

Hello @MohinderS Can you prefix export keyword to all those variables.

export JAVA_HOME=‘xxxxx’
export JAVA_OPTS=‘xxxx’
export DHIS2_HOME=‘xxxxx’
export CATALINA_HOME=‘xxxxx’

Hi @MohinderS Oh no, I’m asking you to prefix an additional unix key word export before your variables. that is missing in instruction but we need to add

After change your lines in setenv file should look something like (don’t copy paste as there could be some errors in my line)

export JAVA HOME=‘/usr/lib/jvm/java-11-openjdk-amd64/’
export JAVA OPTS=’ -Xms512m -Xmx1024m’
export DHIS2 HOME=’ /opt/dhis2’
export CATALINA HOME=‘/usr/share/tomcat9’

2 Likes

Oh Ok, let me add the export before the variables and will update you.

2 Likes

@jthomas , I did the same and its working fine.
There are few things that needs to be changed into the Installation - DHIS2 Documentation documents. Because maximum all people follow these steps.

Thanks

2 Likes

Hi @MohinderS

Thanks! Please feel free to make the suggestions here or make a pull request with the suggestions directly on the Github repo. :+1: