Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-66330

ConstraintViolationException is thrown when updating from 6.2 to 7.0, in case of having two structures (one in global scope, one in a site) with the same structureKey and there is a JournalArticle created with one of them

    Details

      Description

      ConstraintViolationException is thrown when updating from 6.2 to 7.0, in case of having two structures (one in global scope, one in a site) with the same structureKey and there is a JournalArticle created with one of them

      Steps to reproduce

      1. Start Liferay 6.2
      2. Create a site
      3. Create a structure and export/import LAR to global
      4. Create a webcontent with created structure
      5. Shutdown Liferay 6.2
      6. Execute upgrade to master:
        • Expected behavior: upgrade is executed successfully
        • Wrong behavior: a ConstraintViolationException is thrown in com.liferay.journal.upgrade.v0_0_5.UpgradeJournal

      Note: in order to save time, instead executing steps 1 to 4 you can:

      • option a) In a postgresql database, import attached dump: bug_addStorageLink.postgresql_dump
      • option b) Start liferay 6.2, (1) create a site and import LAR Journal-201606030828.portlet.lar in site and global site (2) create a webcontent with that structure

      Following ConstraintViolationException is thrown:

      10:57:54,163 INFO  [main][UpgradeProcess:97] Completed upgrade process com.liferay.journal.upgrade.v0_0_5.UpgradeJournal in 30ms
      INFO - Completed upgrade process com.liferay.journal.upgrade.v0_0_5.UpgradeJournal in 30ms
      10:57:54,166 ERROR [main][com_liferay_portal_upgrade:97] Invocation to listener threw exception
      java.lang.RuntimeException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at com.liferay.portal.upgrade.internal.release.ReleaseManager$UpgradeInfosRunnable.run(ReleaseManager.java:402)
              at com.liferay.portal.output.stream.container.OutputStreamContainerFactoryTracker.runWithSwappedLog(OutputStreamContainerFactoryTracker.java:100)
              at com.liferay.portal.upgrade.internal.release.ReleaseManager.executeUpgradeInfos(ReleaseManager.java:241)
              at com.liferay.portal.upgrade.internal.release.ReleaseManager.doExecute(ReleaseManager.java:225)
              at com.liferay.portal.upgrade.internal.release.ReleaseManager$UpgradeInfoServiceTrackerMapListener.keyEmitted(ReleaseManager.java:352)
              at com.liferay.portal.upgrade.internal.release.ReleaseManager$UpgradeInfoServiceTrackerMapListener.keyEmitted(ReleaseManager.java:342)
              at com.liferay.osgi.service.tracker.collections.internal.map.ServiceTrackerMapImpl$DefaultEmitter.emit(ServiceTrackerMapImpl.java:222)
              at com.liferay.osgi.service.tracker.collections.map.PropertyServiceReferenceMapper.map(PropertyServiceReferenceMapper.java:43)
              at com.liferay.osgi.service.tracker.collections.internal.map.ServiceTrackerMapImpl$ServiceReferenceServiceTrackerCustomizer.addingService(ServiceTrackerMapImpl.java:261)
              at com.liferay.osgi.service.tracker.collections.internal.map.ServiceTrackerMapImpl$ServiceReferenceServiceTrackerCustomizer.addingService(ServiceTrackerMapImpl.java:248)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
              at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
              at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
              at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
              at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
              at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
              at com.liferay.osgi.service.tracker.collections.internal.map.ServiceTrackerMapImpl.open(ServiceTrackerMapImpl.java:94)
              at com.liferay.osgi.service.tracker.collections.map.ServiceTrackerMapFactory.openMultiValueMap(ServiceTrackerMapFactory.java:244)
              at com.liferay.portal.upgrade.internal.release.ReleaseManager.activate(ReleaseManager.java:183)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
              at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
              at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
              at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
              at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)
              at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302)
              at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113)
              at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:866)
              at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:833)
              at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:724)
              at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:954)
              at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:915)
              at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1215)
              at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1136)
              at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:945)
              at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:881)
              at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1167)
              at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:120)
              at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:917)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
              at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:869)
              at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:857)
              at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:133)
              at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:915)
              at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:715)
              at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:954)
              at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:915)
              at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1215)
              at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1136)
              at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:945)
              at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:881)
              at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1167)
              at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:120)
              at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:917)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
              at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1001)
              at com.liferay.registry.internal.RegistryImpl.registerService(RegistryImpl.java:300)
              at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:109)
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:91)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:122)
              at com.liferay.portal.upgrade.internal.release.ReleaseManager$UpgradeInfosRunnable.run(ReleaseManager.java:381)
              ... 75 more
      Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:33)
              at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:175)
              at com.liferay.portal.kernel.dao.orm.ClassLoaderSession.flush(ClassLoaderSession.java:282)
              at com.liferay.portal.dao.orm.hibernate.PortletSessionFactoryImpl.closeSession(PortletSessionFactoryImpl.java:41)
              at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.closeSession(BasePersistenceImpl.java:93)
              at com.liferay.dynamic.data.mapping.service.persistence.impl.DDMStorageLinkPersistenceImpl.updateImpl(DDMStorageLinkPersistenceImpl.java:2208)
              at com.liferay.dynamic.data.mapping.service.persistence.impl.DDMStorageLinkPersistenceImpl.updateImpl(DDMStorageLinkPersistenceImpl.java:69)
              at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:345)
              at com.liferay.dynamic.data.mapping.service.impl.DDMStorageLinkLocalServiceImpl.addStorageLink(DDMStorageLinkLocalServiceImpl.java:45)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:153)
              at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:85)
              at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.service.ServiceContextAdvice.invoke(ServiceContextAdvice.java:40)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:173)
              at com.sun.proxy.$Proxy426.addStorageLink(Unknown Source)
              at com.liferay.journal.upgrade.v0_0_5.UpgradeJournal.addDDMStorageLinks(UpgradeJournal.java:147)
              at com.liferay.journal.upgrade.v0_0_5.UpgradeJournal.doUpgrade(UpgradeJournal.java:250)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:88)
              ... 77 more
      Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
              at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
              at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
              at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
              at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
              at com.liferay.portal.dao.orm.hibernate.SessionImpl.flush(SessionImpl.java:172)
              ... 101 more
      Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into DDMStorageLink (uuid_, companyId, classNameId, classPK, structureId, storageLinkId) values ('7b565a5d-b914-8089-ab40-f2c86b83c050', 0, 20109, 20614, 20573, 23803) was aborted.  Call getNextException to see the cause.
              at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2762)
              at org.postgresql.core.v3.QueryExecutorImpl$1.handleError(QueryExecutorImpl.java:478)
              at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1999)
              at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:421)
              at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2929)
              at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
              at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
              ... 107 more
      10:57:54,454 INFO  [main][ServiceComponentLocalServiceImpl:317] Running IM SQL scripts
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 22 weeks ago

                  Packages

                  Version Package
                  7.0.0 DXP FP5
                  7.0.0 DXP SP1
                  7.0.3 CE GA4
                  Master