Bug 45332 - Encoding issue - Admin password created by Windows installer
Encoding issue - Admin password created by Windows installer
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
6.0.16
PC Windows XP
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2008-07-03 03:02 UTC by Michael Bürschgens
Modified: 2011-02-02 12:59 UTC (History)
0 users



Attachments
Original tomcat-users.xml created by the installer (1.16 KB, text/plain)
2008-07-03 03:02 UTC, Michael Bürschgens
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Bürschgens 2008-07-03 03:02:50 UTC
Created attachment 22211 [details]
Original tomcat-users.xml created by the installer

## Symptom:
After installing Tomcat the service does not start. The following errors are logged in catalina.x.log:

catalina.2008-07-02.log:
----------------------------------
INFO: Initializing Coyote HTTP/1.1 on http-8080
02.07.2008 12:45:10 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 595 ms
02.07.2008 12:45:10 org.apache.naming.NamingContext lookup
WARNUNG: Unexpected exception resolving reference
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 4-byte UTF-8 sequence.
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)

[...]

02.07.2008 12:45:10 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
SCHWERWIEGEND: Exception processing Global JNDI Resources
javax.naming.NamingException: Invalid byte 2 of 4-byte UTF-8 sequence.
	at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
	at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:113)

[...]

02.07.2008 12:45:10 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
02.07.2008 12:45:10 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
02.07.2008 12:45:10 org.apache.naming.NamingContext lookup
WARNUNG: Unexpected exception resolving reference
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 4-byte UTF-8 sequence.
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)

[...]

02.07.2008 12:45:10 org.apache.catalina.realm.UserDatabaseRealm start
SCHWERWIEGEND: Exception looking up UserDatabase under key UserDatabase
javax.naming.NamingException: Invalid byte 2 of 4-byte UTF-8 sequence.
	at org.apache.naming.NamingContext.lookup(NamingContext.java:805)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:153)

...

----------------------------------


## Cause:

The admin password created by the installer is encoded in 8-bit ANSI, probably using Windows codepage, but the file "tomcat-users.xml" is declared as encoded in UTF-8.

tomcat-users.xml:
----------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0

[...]

<tomcat-users>
<user name="admin" password="töst" roles="admin,manager" /><!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
</tomcat-users>
----------------------------------

The German Umlaut "ö" in this example is a single byte value of F6.
If the illegal byte is replaced by an ACSII character such as "o", the service will start.
Comment 1 Mark Thomas 2008-07-06 12:33:19 UTC
This has been fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2008-07-13 11:04:07 UTC
This has been fixed in 6.0.x and will be included in 6.0.18 onwards.
Comment 3 Konstantin Kolinko 2011-02-02 12:59:11 UTC
The fix was backported to 5.5.x in r1066549 and will be in 5.5.33.