モジュール com.liferay.journal.service のアップグレード処理に失敗しました。

問題

  • アップグレード作業中に、エラーが発生することがあります。
    com.liferay.journal.internal.upgrade.v1_1_0.DocumentLibraryTypeContentUpgradeProcess step:
    Caused by: com.liferay.portal.kernel.xml.DocumentException: Error on line 12 of document  : The reference to entity "S" must end with the ';' delimiter.
    at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:409) ~[portal-impl.jar:?]
    at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:383) ~[portal-impl.jar:?]
    at com.liferay.portal.xml.SAXReaderImpl.read(SAXReaderImpl.java:420) ~[portal-impl.jar:?]
    at com.liferay.portal.kernel.xml.SAXReaderUtil.read(SAXReaderUtil.java:161) ~[portal-kernel.jar:?]
    at com.liferay.journal.internal.upgrade.v1_1_0.DocumentLibraryTypeContentUpgradeProcess._convertContent(DocumentLibraryTypeContentUpgradeProcess.java:49) ~[?:?]
    at com.liferay.journal.internal.upgrade.v1_1_0.DocumentLibraryTypeContentUpgradeProcess._updateContent(DocumentLibraryTypeContentUpgradeProcess.java:91) ~[?:?]
    at com.liferay.journal.internal.upgrade.v1_1_0.DocumentLibraryTypeContentUpgradeProcess.doUpgrade(DocumentLibraryTypeContentUpgradeProcess.java:45) ~[?:?]
    at com.liferay.portal.kernel.upgrade.UpgradeProcess.lambda$upgrade$0(UpgradeProcess.java:130) ~[portal-kernel.jar:?]
    at com.liferay.portal.db.partition.DBPartitionUtil.forEachCompanyId(DBPartitionUtil.java:126) ~[portal-impl.jar:?]
    at com.liferay.portal.dao.db.BaseDB.process(BaseDB.java:337) ~[portal-impl.jar:?]
    at com.liferay.portal.kernel.dao.db.BaseDBProcess.process(BaseDBProcess.java:387) ~[portal-kernel.jar:?]
    at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:115) ~[portal-kernel.jar:?]
    ...
  • このエラーは、XML文書にタグが閉じられていなかったり、誤入力があったりと、エラーがある場合に投げられます。
  • アップグレードステップでは、Document Libraryフィールドを含むWebコンテンツ(ジャーナル記事)のクエリを実行します。
  • このエラーは、ドキュメントライブラリフィールドを持つ1つまたは複数のWebコンテンツに、WebコンテンツのコンテンツXMLに問題があることを示します。

Environment

  • Liferay DXP 7.4

解決策

  • 以下のクエリで、行を確認することができます:
    select content, id_ from JournalArticle where content like '%type=\"document_library\"%';
  • 添付のgroovyスクリプトを実行すると、リストされた行を検証することができます。
    import com.liferay.portal.kernel.xml.SAXReaderUtil;
    import com.liferay.portal.kernel.xml.Document;
    import com.liferay.journal.model.JournalArticle;
    import com.liferay.journal.service.JournalArticleLocalServiceUtil;
    import com.liferay.portal.kernel.dao.jdbc.DataAccess;
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;

    Logger logger = LoggerFactory.getLogger(com.liferay.portal.scripting.groovy.internal.GroovyExecutor.class);
    logger.info("Starting validating web content XMLs...");

    Connection con = null;

    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
    con = DataAccess.getConnection();
    String statement = "select id_ from JournalArticle where content like " +
    "'%type=\"document_library\"%'";
    ps = con.prepareStatement(statement);
    rs = ps.executeQuery();

    List<Long> articleIds = new ArrayList<>();
    List<Long> invalidArticleIds = new ArrayList<>();

    while(rs.next()) {
    articleIds.add(rs.getLong("id_"));
    }
    for(long articleId : articleIds) {
    JournalArticle article = JournalArticleLocalServiceUtil.getArticle(articleId);
    String content = article.getContent();
    try {
    Document document = SAXReaderUtil.read(content);
    } catch (Exception e) {
    invalidArticleIds.add(articleId);
    }
    }

    if(invalidArticleIds.size() > 0) {
    logger.info("The articles with the following IDs have issues in their content XML (" + invalidArticleIds.size() + " in total):");
    for(long articleId : invalidArticleIds) {
    logger.info((String)articleId);
    }
    } else {
    logger.info("All of the specified articles' content XMLs are valid.");
    }
    } catch (Exception e) {
    logger.info("Failed to read the articles from the database " + e.printStackTrace());
    } finally {
    DataAccess.cleanUp(con, ps, rs);
    }
    logger.info("Script is finished.");
  • 不具合のあるものがあれば、XMLの値が修正されていることを確認する必要があります
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています