Confluence Space import failed with 'Unable to complete import: Error while importing backup: For input string: ""'

お困りですか?

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

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

要約

Space import failed with Unable to complete import: Error while importing backup: For input string: ""

The following ERROR appears in the <confluence-home>/atlassian-confluence.log:

ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.BackupImporter] importEntities Cannot import the entities: 
 -- url: /admin/restore.action | referer: http://localhost:8090/admin/backup.action | traceId: 8dbf8747b6d762f5 | userName: admin | action: restorecom.atlassian.confluence.importexport.ImportExportException: Unable to complete import: Error while importing backup: For input string: ""


環境

Confluence 6.15.4

診断

The stack trace before the ERROR shows that Confluence is having an issue importing the Property[bodyType]=] as it does not contain the value that described the content bodytype (Wiki, Raw, XHTML):

ERROR [Long running task: Importing data] [confluence.importexport.xmlimport.DefaultImportProcessor] persist Error while saving object: Imported[com.atlassian.confluence.core.BodyContent] [Id[id]=17183583, Property[body]=<h2>Congratulations! your Blog has been Posted. </h2><h2>The Blog Post title includes a timestamp, which reduces the possibility of blog title conflicts.</h2><h2>After you delete this draft, you will be redirected to your Post and you can edit and rename the Blog title.</h2><h2>You must now delete this draft page <div style="display:inline-block">
<form action="/plugins/servlet/pageToBlogServlet" method="post">
<input type="hidden" name="space" value="~c3019"/>
<input type="hidden" name="title" value="Test Space's Home"/>
<input type="hidden" name="blog" value="/pages/viewpage.action?pageId=17156661"/>
<input class="aui-button aui-style aui-button-primary" type="submit" value="Delete Draft"/>
</form>
</div>.</h2>
, Property[content]=com.atlassian.confluence.pages.Page[Id[id]=17156004], Property[bodyType]=]
 -- url: /admin/restore.action | referer: http://localhost:8090/admin/backup.action | traceId: 8dbf8747b6d762f5 | userName: admin | action: restore


原因 1

This error is caused by NULL value in bodytypeid column which may occur after a failed Wiki Markup to XHTML Migration during the upgrade or manual wikiToXhtmlMigrationUpgradeTask.

Running the following query will identify pages that are affected by this problem:

SELECT * FROM bodycontent WHERE contentid IN (SELECT c.contentid FROM CONTENT AS c WHERE CONTENTTYPE IN ("PAGE","COMMENT")) AND  bodytypeid IS NULL;


原因 2

This can also happens due to an existing character in the page body that conflicts with XML standards. For example, the page contain a third party plugin or character that could not be converted to XML as Confluence does not recognise the type of the body (either 0, 1, or 2).

ソリューション 1

データベースへの変更を行う前に、データベースの完全なバックアップを作成済みで Confluence がシャットダウン済みであることをご確認ください。その後、次のクエリを実行します。

  1. Confluence を停止します。
  2. Run the following SQL query in Confluence Database:

    UPDATE BODYCONTENT SET bodytypeid = 2 WHERE contentid IN ( SELECT c.contentid FROM CONTENT AS c WHERE CONTENTTYPE IN ("PAGE","COMMENT") ) AND bodytypeid IS NULL;
    1. BodyTypeId = 0 (Wiki)

    2. BodyTypeId = 1 (Raw)

    3. BodyTypeId = 2 (XHTML)

  3. Confluence を起動します。


ソリューション 2

  1. UnZip the Space export file. 
  2. Edit the entities.xml file and search for the string below:

    <property name="bodyType"/></object>
    1. (info) For a large file, use the grep command below to find the line:

      grep -i '<property name="bodyType"/></object>' entities.xml
  3. Correct the string by inserting the value for <property name="bodyType">. The new modified string should looks like the following:

    <property name="bodyType">2</property></object>
    1. (info) Use the sed command to find and replace the line:

      sed 's#<property name="bodyType"/></object>#<property name="bodyType">2</property></object>#g' entities.xml 
  4. Zip the backup with the modified entities.xml file and reimport the Space into Confluence.




最終更新日 2020 年 8 月 31 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.