Got permission denied on server.xml when installing v40.2.1 with docker

I’ve try to update my latest dhis2 v40 to the latest hotfix release with the latest docker for v40.2.1. But I am getting the permission issue on server.xml when start the dhis2 container :

NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
15-Jan-2024 04:28:28.980 WARNING [main] org.apache.catalina.startup.Catalina.parseServerXml Unable to load server configuration from [/usr/local/tomcat/conf/server.xml]
	java.io.FileNotFoundException: /usr/local/tomcat/conf/server.xml (Permission denied)
		at java.base/java.io.FileInputStream.open0(Native Method)
		at java.base/java.io.FileInputStream.open(Unknown Source)
		at java.base/java.io.FileInputStream.<init>(Unknown Source)
		at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:90)
		at org.apache.tomcat.util.file.ConfigurationSource.getConfResource(ConfigurationSource.java:150)
		at org.apache.tomcat.util.file.ConfigurationSource.getServerXml(ConfigurationSource.java:127)
		at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getServerXml(CatalinaBaseConfigurationSource.java:52)
		at org.apache.catalina.startup.Catalina.parseServerXml(Catalina.java:606)
		at org.apache.catalina.startup.Catalina.load(Catalina.java:709)
		at org.apache.catalina.startup.Catalina.load(Catalina.java:746)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
		at java.base/java.lang.reflect.Method.invoke(Unknown Source)
		at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:307)
		at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:477)
15-Jan-2024 04:28:28.988 WARNING [main] org.apache.catalina.startup.Catalina.parseServerXml Permissions incorrect, read permission is not allowed on the file
15-Jan-2024 04:28:28.991 SEVERE [main] org.apache.catalina.startup.Catalina.start Cannot start server, server instance is not configured
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED

I there any suggestion to fix this issue ?

2 Likes

Hi @AriPurnama

Which guide did you follow to run DHIS2 on Docker? I follow this guide: DHIS2 in Docker | DHIS2 Developer Portal

It doesn’t really contain any requirement to configuring the file access settings; however, the error you shared shows that there is an issue with file permissions.

I just update the image version on the docker-compose file

Which exact image are you using?

I just tried with this and it works as expected.

1 Like