Invalid locale format errors for certain users

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Getting the following System Error message in the Confluence browser when logging in as certain user:

(Auto-migrated image: description temporarily unavailable)

The following appears in the atlassian-confluence.log

1 2 3 4 5 6 Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.confluence.util.i18n.I18NBean]: Factory method 'getI18NBean' threw exception; nested exception is java.lang.IllegalArgumentException: Invalid locale format: zh_HANS-CN at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ... 335 more Caused by: java.lang.IllegalArgumentException: Invalid locale format: zh_HANS-CN at org.apache.commons.lang3.LocaleUtils.toLocale(LocaleUtils.java:141)

Cause

Confluence users could choose their Language preference from their profile settings:

(Auto-migrated image: description temporarily unavailable)

For some reason, the corresponding data saved in the database is invalid as per Internationalization standard. For example, the above error logs shows invalid locale format of zh_HANS-CN where the correct locale for Chinese is zh_CN.

This documentation from Oracle: Internationalization: Understanding Locale in the Java Platform contains further information on the different codes to be set for language and country codes.

Diagnosis

The locale information are stored in the os_propertyentry table, with the entity_key value of confluence.user.locale:

entity_name

entity_key

string_val

USERPROPS-8a80cb8165e647ab0165e64aa0430000

confluence.user.locale

zh_HANS-CN

Resolution

  1. Perform database update to alter these values to the correct one. In this example, use the following SQL query to update the invalid locale format of zh_HANS-CN to the correct locale format zh_CN.

    1 UPDATE os_propertyentry SET string_val = 'zh_CN' WHERE entity_key = 'confluence.user.locale' AND string_val = 'zh_HANS-CN';

    Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

  2. Clear Caches by going to

    (Auto-migrated image: description temporarily unavailable)

    > General Configuration > Cache Management > Flush all.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.