XML backup import fails with GenericEntityException in Jira server


アトラシアン コミュニティをご利用ください。



When importing a JIRA XML backup to a JIRA instance with PostgreSQL in the backend, a GenericEntityException is thrown.  This is caused by the following SQL exception:

Error importing data: java.lang.Exception: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Action][id,31274][body...
SQL Exception while executing the following:INSERT INTO public.jiraaction (ID, issueid, AUTHOR, actiontype, actionlevel, rolelevel, actionbody, CREATED, UPDATEAUTHOR, UPDATED, actionnum) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: invalid byte sequence for encoding "UTF8": 0x00)


The import process to PostgreSQL is trying to interpret plain-text comments as UTF-8 characters and will end up with the above errors because of the NULL values in the data.


The best way to confirm this is to unzip the JIRA XML backup and examine the entities.xml file by one of two ways:

  • Using vim:
    1. vim -b entities.xml
    2. type :sy off to turn off colouring of output.
    3. type /^Vx00 to search for the NULL character.
      ^V means Control + V, which tells vim you're about to type something you want it to interpret literally. x00 is the character sequence for the NULL character.
  • The other way you can find the NULL is with grep
grep -nE '\x00' entities.xml | cat -v

Once you find and confirm there are NULLl values in the *entities.xml* file you can run the below command to fix it:

perl -pi -e 's/\x00//g' entities.xml

This strips the NULL character from the data. Once the file is fixed, re-archive it to it's original zip file and import it into JIRA which should work fine.

ソリューション 2

After unzip the JIRA XML backup, you can use the Atlassian XML Cleaner

  1. Download atlassian-xml-cleaner-0.1.jar from this document.
  2. コマンド プロンプトを開き、コンピューター上で XML または ZIP のバックアップ ファイルを見つけます。ZIP ファイル内にある場合はそれが展開されていることを確認します。この例では entities.xml を使います。
  3. Run the application with the below:

    $ java -jar atlassian-xml-cleaner-0.1.jar entities.xml > entities-clean.xml

    無効な文字が削除された entities-clean.xml が、entities.xml のコピーとして作成されます。 

  4. Copy the entities-clean.xml and activeobjects.xml files into another directory, rename it back to entities.xml and create a new ZIP file to be imported.
  5. Import the new ZIP file, ensuring that it contains both XML files.

最終更新日 2021 年 7 月 6 日


Powered by Confluence and Scroll Viewport.