Maintenanace page bad characters

Hi all I recently installed dhis2 on a Windows PC but i have a small issue could someone assist on fixing this issue.

1 Like

Hi @Jay, welcome to the dhis2 community. :wave:

A couple of questions:

  • Are you seeing the same problem on e.g. https://play.dhis2.org/dev/dhis-web-maintenance/index.html#/list/all ?

  • Do you see the problem on multiple browsers in Windows?

  • What version of Tomcat are you running?

  • Could you provide your server.xml for Tomcat?

  • Are you running NGinx in front of Tomcat or are you accessing e.g. http://localhost:8080 directly?

Cheers
/v.

1 Like

Hello,

This seems to be a similar issue as that @em.hispvietnam faced and posted about in this topic: Icon error in Maintenance app on Windows OS server

It has to do with the Tomcat version, you can downgrade the Tomcat version until this issue is resolved. Please also add a comment saying you are facing the issue and vote for the JIRA issue here: https://jira.dhis2.org/browse/DHIS2-7269

1 Like

Hi,

More specifically, this error was identified for Tomcat 8.5.43 and 9.0.22 (released at the same time) - 8.5.42 and 9.0.21 work fine.

@Jay what tomcat version are you using? Please confirm if it is 8.5.46 (the latest) or 9.0.26 (latest) - if yes, then we know this is a permanent Tomcat change breaking compatibility with DHIS2 (and the DHIS2 core devs need to fix it).

Regards
Calle

1 Like

Hi,
I am currently using tomcat 9.0.22 and dhis version 2.30

1 Like

Hi @varl,

  1. On the https://play.dhis2.org/dev/dhis-web-maintenance/index.html#/list/all the icons are okay.
  2. On all my browsers I see the same issue.
  3. I am running tomcat version 9.0.
  4. My server.xml configuration
<?xml version="1.0" encoding="UTF-8"?>
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
    maxThreads="150" minSpareThreads="4"/>
-->


<!-- A "Connector" represents an endpoint by which requests are received
     and responses are returned. Documentation at :
     Java HTTP Connector: /docs/config/http.html
     Java AJP  Connector: /docs/config/ajp.html
     APR (HTTP/AJP) Connector: /docs/apr.html
     Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
     This connector uses the NIO implementation. The default
     SSLImplementation will depend on the presence of the APR/native
     library and the useOpenSSL attribute of the
     AprLifecycleListener.
     Either JSSE or OpenSSL style configuration may be used regardless of
     the SSLImplementation selected. JSSE style configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true">
    <SSLHostConfig>
        <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                     type="RSA" />
    </SSLHostConfig>
</Connector>
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
     This connector uses the APR/native implementation which always uses
     OpenSSL for TLS.
     Either JSSE or OpenSSL style configuration may be used. OpenSSL style
     configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
           maxThreads="150" SSLEnabled="true" >
    <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
    <SSLHostConfig>
        <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                     certificateFile="conf/localhost-rsa-cert.pem"
                     certificateChainFile="conf/localhost-rsa-chain.pem"
                     type="RSA" />
    </SSLHostConfig>
</Connector>
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


<!-- An Engine represents the entry point (within Catalina) that processes
     every request.  The Engine implementation for Tomcat stand alone
     analyzes the HTTP headers included with the request, and passes them
     on to the appropriate Host (virtual host).
     Documentation at /docs/config/engine.html -->

<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">

  <!--For clustering, please take a look at documentation at:
      /docs/cluster-howto.html  (simple how to)
      /docs/config/cluster.html (reference documentation) -->
  <!--
  <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
  -->

  <!-- Use the LockOutRealm to prevent attempts to guess user passwords
       via a brute-force attack -->
  <Realm className="org.apache.catalina.realm.LockOutRealm">
    <!-- This Realm uses the UserDatabase configured in the global JNDI
         resources under the key "UserDatabase".  Any edits
         that are performed against this UserDatabase are immediately
         available for use by the Realm.  -->
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
           resourceName="UserDatabase"/>
  </Realm>

  <Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">

    <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
    <!--
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    -->

    <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log" suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />

  </Host>
</Engine>
5. Accessing it as localhost
1 Like

Hi,

I have just tested Tomcat 8.5.46 (the newest version), and the problem is still there - so it is obvious that this Icon error problem is a permanent issue with Tomcat 8.5.43 and later, as well as Tomcat 9.0.22 and later. Or in other words, DHIS2 is no longer fully compatible with newer versions of Tomcat 8.5.x and 9.0.x. There might be some configuration setting available that would bypass the problem, but in any case the issue is now a job for the relevant core dev team. @varl can you please investigate the issue - just run any DHIS2 instance under 8.5.43 or later, or 9.0.22 or later. Then go to e.g. Maintenance

NOTE re questions above: I am running localhost directly (no nginx or other load balancing software) and the server.xml is the default. I have tested with and without the setting added to Tomcat’s context.xml file, but that has no bearing on the problem (increasing Tomcat’s cache size seems to be required on Windows if you want full access to the icon library)

Best regards from Sierra Leone
Calle

1 Like

Thanks @Calle_Hedberg and @Jay. I’ll take a look at this today.

1 Like

Hi @Calle_Hedberg and @Jay

I’ve spent the day on this and tested these Tomcat versions:

  • Tomcat 8.5.34
  • Tomcat 8.5.46
  • Tomcat 9.0.26

All of these work properly on Linux, so I don’t think this is a problem with the DHIS2 core software specifically. I suspect it is the Java encoding in Windows that is tripping this up. Tomcat recently changed to falling back to the system default if it is not provided across all major tomcat channels (8.0.x, 8.5.x, and 9.0.x).

Could you please provide the output of:

java -XshowSettings:properties -version

I am specifically interested in the file.encoding property.

If that is set to windows-1252 (or anything except UTF-8/UTF8) then doing this in tomcat/bin/setenv.bat should do the trick:

set "JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8"

Hope this helps and hearing back from you with the requested information.

Cheers
/v.

1 Like

Viktor,

@varl I think you are definitely on to something here - my output is below, and the file.encoding is codepage 1252 (the most common western codepage). I had not spotted that Tomcat change, but it would explain why the problem suddenly appeared with versions 8.5.43 and 9.0.22 - my default java codepage has been 1252 all along, but never caused problems because Tomcat was sort of “overlooking” the issue.

I even wonder if this might resolve another JIRA issue related to SQL View output not displaying “extended” characters correctly.

I will test this right now.

Best regards from Freetown, Sierra Leone
Calle

C:\Users\Calle_Hedberg>java -XshowSettings:properties -version
Property settings:
awt.toolkit = sun.awt.windows.WToolkit
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator =
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = C:\Program Files\Java\jre1.8.0_221\lib\endorsed
java.ext.dirs = C:\Program Files\Java\jre1.8.0_221\lib\ext
C:\WINDOWS\Sun\Java\lib\ext
java.home = C:\Program Files\Java\jre1.8.0_221
java.io.tmpdir = C:\Users\Calle_Hedberg\AppData\Local\Temp
java.library.path = C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\WINDOWS\Sun\Java\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\Program Files\Python36\Scripts
C:\Program Files\Python36
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\ProgramData\Oracle\Java\javapath
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\PostgreSQL\12\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0
C:\WINDOWS\System32\OpenSSH
C:\Program Files\PuTTY
C:\Program Files\Intel\WiFi\bin
C:\Program Files\Common Files\Intel\WirelessCommon
C:\Program Files (x86)\Brackets\command
C:\Program Files\Git\cmd
C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL
C:\Program Files\Intel\Intel® Management Engine Components\DAL
C:\Users\Calle_Hedberg\AppData\Local\Microsoft\WindowsApps
C:\Program Files\Microsoft VS Code\bin
C:\Program Files\Intel\WiFi\bin
C:\Program Files\Common Files\Intel\WirelessCommon
C:\Users\Calle_Hedberg\AppData\Local\GitHubDesktop\bin
.
java.runtime.name = Java™ SE Runtime Environment
java.runtime.version = 1.8.0_221-b11
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_221
java.vm.info = mixed mode
java.vm.name = Java HotSpot™ 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.221-b11
line.separator = \r \n
os.arch = amd64
os.name = Windows 10
os.version = 10.0
path.separator = ;
sun.arch.data.model = 64
sun.boot.class.path = C:\Program Files\Java\jre1.8.0_221\lib\resources.jar
C:\Program Files\Java\jre1.8.0_221\lib\rt.jar
C:\Program Files\Java\jre1.8.0_221\lib\sunrsasign.jar
C:\Program Files\Java\jre1.8.0_221\lib\jsse.jar
C:\Program Files\Java\jre1.8.0_221\lib\jce.jar
C:\Program Files\Java\jre1.8.0_221\lib\charsets.jar
C:\Program Files\Java\jre1.8.0_221\lib\jfr.jar
C:\Program Files\Java\jre1.8.0_221\classes
sun.boot.library.path = C:\Program Files\Java\jre1.8.0_221\bin
sun.cpu.endian = little
sun.cpu.isalist = amd64
sun.desktop = windows
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = Cp1252
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level =
sun.stderr.encoding = cp437
sun.stdout.encoding = cp437
user.country = ZA
user.dir = C:\Users\Calle_Hedberg
user.home = C:\Users\Calle_Hedberg
user.language = en
user.name = Calle_Hedberg
user.script =
user.timezone =
user.variant =

java version “1.8.0_221”
Java™ SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot™ 64-Bit Server VM (build 25.221-b11, mixed mode)

1 Like

@varl

BINGO - there is no setenv.bat file in the tomcat/bin/ directory, but I created one with the
set “JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF8”
line as the only content.

I then upgraded again to 8.5.46, started tomcat, and

  • The nonsense icons under Maintenance is now gone, so setting the java file encoding to UTF8 did the trick.
  • The output of SQL views was not showing correctly (JIRA issue #4651 - over one year old!!), but this change to the codepage has resolved that too.

I have occasionally noted similar issues with a variety of XML/excel outputs from DHIS2, and I suspect this fix will resolve many of those issues too.

I have added the above fix to #4651, but can you please close the issue?

I would also suggest that this issue and its solution are added to the installation manual in a WARNING box (or something like that). 98% of all users are unlikely to be aware that their 64 bits Tomcat installation running on 64 bits window by default will be running an 8-bits codepage…

At least 2 birds with one stone - that’s good work, Viktor :wink:

Best regards
Calle

1 Like

Very cool!

Glad that it did the trick. :tada:

1 Like