legacy-knowledge-base
公開されました Sep. 10, 2025

DBアップグレード後の起動時のPRIMARY KEY制約違反

written-by

Dávid Hegedüs

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • db-upgrade ツールを使用して DB を正常にアップグレードした後、新規起動時に次のようなエラーに直面する場合があります。
    2020-12-11 08:41:05.671 ERROR [main][JDBCExceptionReporter:234] Violation of PRIMARY KEY constraint 'PK__Resource__5BB6F3C1121C39C4'. Cannot insert duplicate key in object 'dbo.ResourceAction'. The duplicate key value is (4523).
    2020-12-11 08:41:05.687 ERROR [main][PortletTracker:360] Portlet com_liferay_portal_workflow_metrics_web_internal_portlet_WorkflowMetricsPortlet from com.liferay.portal.workflow.metrics.web_1.0.25 [385] failed to initialize
    com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
    at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:446)
    at com.liferay.portal.service.persistence.impl.ResourcePermissionPersistenceImpl.findByC_N_S_R(ResourcePermissionPersistenceImpl.java:4015)
    at com.liferay.portal.service.persistence.impl.ResourcePermissionPersistenceImpl.findByC_N_S_R(ResourcePermissionPersistenceImpl.java:3873)
    at com.liferay.portal.service.persistence.impl.ResourcePermissionPersistenceImpl.findByC_N_S_R(ResourcePermissionPersistenceImpl.java:3824)
    ...

Environment

  • Liferay ポータル 6.2
  • ライフレイ DXP 7.x

解決策

  • portal-ext.properties で設定されたプロパティを確認し、次を探す必要があります:
    counter.increment=1
  • 不要な場合はこのプロパティを削除するか、問題が発生しないように適切に構成してください。

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base