JIRA Directory synchronisation fails due to invalid XML character
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
Summary
Issue
Your Bitbucket Server is configured to use JIRA as a User Directory but suddenly stopped working. In the logs you can find an error like that:
ERROR log
1
2
3
4
ERROR [Caesium-1-4] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 123456 ].
com.atlassian.crowd.exception.OperationFailedException: javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1432; An invalid XML character (Unicode: 0x1a) was found in the value of attribute "name" and element is "user".]
Solution
There are two ways of determining which name causes the issue:
Option 1:
Query the cwd_user table for any data containing character put in brackets. In our example, it's (Unicode: 0x1a).
The query depends on the database type, as the Unicode character might be represented differently in different databases.
If you wish to follow this path, please build a SELECT statement querying the JIRA CWD_USER table for the Unicode character mentioned in the log.
Option 2:
Save the output of:
1
SELECT * FROM CWD_USER;
to cwd_user.txt file
and search for the invalid characters manually:
1
grep --color='auto' --line-number --perl-regexp "[^\x00-\x7F]" cwd_user.txt
Once you find the faulty credentials, please correct them in JIRA (manually removing it and adding again should be enough), and start the synchronization again.
Was this helpful?