Foren

BatchUpdateException: Batch entry 0 insert into LayoutSet

thumbnail
Ankit Pancholi, geändert vor 8 Jahren.

BatchUpdateException: Batch entry 0 insert into LayoutSet

Junior Member Beiträge: 78 Beitrittsdatum: 07.01.10 Neueste Beiträge
Hi All,

Looking for some help on following exception occurring on Production, find below configuration & error logs.

I am using Liferay 6.2 EE SP10 with required clustering configuration tuned for production and also deployed Ehcache Cluster EE war. with 2 liferay servers pointing to PostgresDB on master/slave configuration configured at database side.

following are applicable portal-ext.properties around clustering or tuned setting,
# Clustering configuration
cluster.link.enabled=true
lucene.replicate.write=true
cluster.link.autodetect.address=DB IP: Port

# Ehcache Cluster EE app must be installed or cache replication will not work with this configuration
ehcache.cluster.link.replication.enabled=true
# Enables ehcache to use multicasting
net.sf.ehcache.configurationResourceName=/ehcache/hibernate-clustered.xml
ehcache.multi.vm.config.location=/ehcache/liferay-multi-vm-clustered.xml

# FileSystemStore nfs path to data folder
dl.store.impl=com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore
dl.store.file.system.root.dir=/opt/data/document_library
image.hook.file.system.root.dir=/opt/data/images
# Lucene indexes are maintained on individual servers, since NFS cluster aware is not available
#lucene.dir=/opt/data/lucene/
module.framework.base.dir=/opt/data/osgi

session.tracker.memory.enabled=false

plugin.repositories.trusted=
plugin.repositories.untrusted=
plugin.notifications.enabled=false

permissions.inline.sql.check.enabled=false

lucene.commit.batch.size=10000
lucene.commit.time.interval=300000
lucene.merge.factor=10
lucene.buffer.size=32
counter.increment=2000
counter.increment.com.liferay.portal.model.Layout=10


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
We have custom action that calls following API to apply site template to particular site based on group passed and site template id i.e. curLayoutSetPrototype.getLayoutSetPrototypeId()

SitesUtil.updateLayoutSetPrototypesLinks(group, 0L, curLayoutSetPrototype.getLayoutSetPrototypeId(), false, true);


Issue seems to be intermittent, Any idea what could be causing duplicate layoutset_pkey value?
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
13:41:09,049 ERROR [ajp-bio-8009-exec-131][JDBCExceptionReporter:82] Batch entry 0 insert into LayoutSet (groupId, companyId, createDate, modifiedDate, privateLayout, logo, logoId, themeId, colorSchemeId, wapThemeId, wapColorSchemeId, css, pageCount, settings_, layoutSetPrototypeUuid, layoutSetPrototypeLinkEnabled, layoutSetId) values (68054, 20157, '2015-06-30 13:41:08.659000 +01:00:00', '2015-06-30 13:41:08.659000 +01:00:00', '1', '0', 0, 'classic', '01', 'mobile', '01', '', 0, '', '7e6013a7-e209-43a5-a481-31b9f60066cc', '1', 68055) was aborted. Call getNextException to see the cause.
13:41:09,050 ERROR [ajp-bio-8009-exec-131][JDBCExceptionReporter:82] ERROR: duplicate key value violates unique constraint "layoutset_pkey"_ Detail: Key (layoutsetid)=(68055) already exists. [Sanitized]
13:41:09,053 ERROR [ajp-bio-8009-exec-131][DefaultTransactionExecutor:93] Application exception overridden by commit exception
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into LayoutSet (groupId, companyId, createDate, modifiedDate, privateLayout, logo, logoId, themeId, colorSchemeId, wapThemeId, wapColorSchemeId, css, pageCount, settings_, layoutSetPrototypeUuid, layoutSetPrototypeLinkEnabled, layoutSetId) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:637)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.processCommit(DefaultTransactionExecutor.java:82)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:70)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
at com.sun.proxy.$Proxy46.updateLayoutSetPrototypeLinkEnabled(Unknown Source)
at com.liferay.portal.service.LayoutSetServiceUtil.updateLayoutSetPrototypeLinkEnabled(LayoutSetServiceUtil.java:88)
at com.liferay.portlet.sites.util.SitesImpl.updateLayoutSetPrototypeLink(SitesImpl.java:1934)
at com.liferay.portlet.sites.util.SitesImpl.updateLayoutSetPrototypesLinks(SitesImpl.java:1495)
at com.liferay.portlet.sites.util.SitesUtil.updateLayoutSetPrototypesLinks(SitesUtil.java:348)
at com.conv.portal.util.ConvSiteUtil.applySiteTpl(ConvSiteUtil.java:216)
at com.conv.platform.usermanagement.service.OrganisationServiceImpl.createOrganisation(OrganisationServiceImpl.java:42)
at com.conv.firmverification.service.FirmVerificationServiceImpl.approveFirm_aroundBody0(FirmVerificationServiceImpl.java:254)
at com.conv.firmverification.service.FirmVerificationServiceImpl$AjcClosure1.run(FirmVerificationServiceImpl.java:1)
at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96cproceed(AbstractTransactionAspect.aj:59)
at org.springframework.transaction.aspectj.AbstractTransactionAspect$AbstractTransactionAspect$1.proceedWithInvocation(AbstractTransactionAspect.aj:65)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:63)
at com.conv.firmverification.service.FirmVerificationServiceImpl.approveFirm(FirmVerificationServiceImpl.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy2051.approveFirm(Unknown Source)
at com.conv.firmverification.managedbeans.FirmVerificationManagedBean.approve(FirmVerificationManagedBean.java:505)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:183)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:161)
at com.sun.el.parser.AstValue.invoke(AstValue.java:228)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:786)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1251)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at com.liferay.faces.bridge.BridgePhaseResourceImpl.execute(BridgePhaseResourceImpl.java:103)
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:128)
at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:178)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:122)
at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:82)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:116)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:71)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:580)
at com.liferay.portlet.InvokerPortletImpl.invokeResource(InvokerPortletImpl.java:675)
at com.liferay.portlet.InvokerPortletImpl.serveResource(InvokerPortletImpl.java:441)
at com.liferay.portlet.PortletContainerImpl._doServeResource(PortletContainerImpl.java:792)
at com.liferay.portlet.PortletContainerImpl.serveResource(PortletContainerImpl.java:152)
at com.liferay.portlet.SecurityPortletContainerWrapper.serveResource(SecurityPortletContainerWrapper.java:166)
at com.liferay.portlet.RestrictPortletContainerWrapper.serveResource(RestrictPortletContainerWrapper.java:166)
at com.liferay.portal.kernel.portlet.PortletContainerUtil.serveResource(PortletContainerUtil.java:164)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:386)
at com.liferay.portal.action.LayoutAction.doExecute(LayoutAction.java:200)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:95)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:179)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:549)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:526)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.conv.portal.filter.ConvVirtualHostFilter.doFilter(ConvVirtualHostFilter.java:174)
at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
at com.sun.proxy.$Proxy1349.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:243)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.etag.ETagFilter.processFilter(ETagFilter.java:86)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.conv.portal.filter.ConvVirtualHostFilter.doFilter(ConvVirtualHostFilter.java:174)
at sun.reflect.GeneratedMethodAccessor618.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
at com.sun.proxy.$Proxy1349.doFilter(Unknown Source)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at com.mulesoft.tcat.monitoring.tomcat.Tomcat55AgentValve.invoke(Tomcat55AgentValve.java:20)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:218)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:193)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
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 org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
... 212 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into LayoutSet (groupId, companyId, createDate, modifiedDate, privateLayout, logo, logoId, themeId, colorSchemeId, wapThemeId, wapColorSchemeId, css, pageCount, settings_, layoutSetPrototypeUuid, layoutSetPrototypeLinkEnabled, layoutSetId) values (68054, 20157, '2015-06-30 13:41:08.659000 +01:00:00', '2015-06-30 13:41:08.659000 +01:00:00', '1', '0', 0, 'classic', '01', 'mobile', '01', '', 0, '', '7e6013a7-e209-43a5-a481-31b9f60066cc', '1', 68055) was aborted. Call getNextException to see the cause.
at com.edb.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2827)
at com.edb.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2237)
at com.edb.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:700)
at com.edb.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2986)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1135)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 220 more
13:41:09,055 ERROR [ajp-bio-8009-exec-131][ConvSiteUtil:230] null
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into LayoutSet (groupId, companyId, createDate, modifiedDate, privateLayout, logo, logoId, themeId, colorSchemeId, wapThemeId, wapColorSchemeId, css, pageCount, settings_, layoutSetPrototypeUuid, layoutSetPrototypeLinkEnabled, layoutSetId) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

Same question also posted on stackoverflow, http://stackoverflow.com/questions/31244472/liferay-batchupdateexception-batch-entry-0-insert-into-layoutset

Appreciate for your help in advance..

Thanks.
thumbnail
Bijan Vakili, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Expert Beiträge: 375 Beitrittsdatum: 10.03.09 Neueste Beiträge
ERROR: duplicate key value violates unique constraint "layoutset_pkey"_ Detail: Key (layoutsetid)=(68055) already exists.


That seems to be the main issue here. "layoutSetId" is primary key; as such it must be a unique value; as such cannot have such a duplicate; and something is trying to add again.

Just that one call shouldn't cause this issue:
SitesUtil.updateLayoutSetPrototypesLinks(group, 0L, curLayoutSetPrototype.getLayoutSetPrototypeId(), false, true);


What is the behavior when error? Since you said it's only intermittent. Is the template applied or has it failed?

Does issue happen in non-clustered env? That is, have there been any such reports?

A reference for alternate code snip: http://stackoverflow.com/questions/18330804/in-liferay-how-can-i-change-the-site-template-associated-to-a-site
thumbnail
Ankit Pancholi, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Junior Member Beiträge: 78 Beitrittsdatum: 07.01.10 Neueste Beiträge
Yes Bijan, It is trying to insert layoutSet entry with primary key "layoutSetId"= 68055 and it already exists, so the duplicate key value violates error.

Only thing I could suspect, however I am not sure. The ID generated was cached and the other Liferay server in cluster was'nt aware and it incremented to same ID 68055 while it was inserting.

Site pages were not created so I feel the site template was not applied, Since it was production env and I had to delete the site urgently so I could not verify whether the site template was linked, but the pages were not created for sure. Issue does not occur on Non-Clustered environment

The link you shared http://stackoverflow.com/questions/18330804/in-liferay-how-can-i-change-the-site-template-associated-to-a-site
tells to use method LayoutSetLocalServiceUtil.updateLayoutSetPrototypeLinkEnabled(..) which is already getting called inside below method
SitesUtil.updateLayoutSetPrototypesLinks(group, 0L, curLayoutSetPrototype.getLayoutSetPrototypeId(), false, true); and the exception is within this call for LayoutSet.
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet (Antwort)

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Ankit Pancholi:
Only thing I could suspect, however I am not sure. The ID generated was cached and the other Liferay server in cluster was'nt aware and it incremented to same ID 68055 while it was inserting.


That would be my guess.

You could change the counter increment to 1 (basically disables node caching of counter ranges)...
thumbnail
Ankit Pancholi, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Junior Member Beiträge: 78 Beitrittsdatum: 07.01.10 Neueste Beiträge
Thanks David,

But this can lead to some performance concern ? As per liferay it is recommended to give higher value to counter.increment

    # Set the number of increments between database updates to the Counter
    # table. Set this value to a higher number for better performance.
    counter.increment=100


setting counter.increment to 1 will cause database call on every inserts to Liferay tables
Any alternative solution/pointers that can be looked at ? seems to be cache issue in cluster, as the counter value is maintained in JVM.


Olaf: I understand sorry and thanks It got skipped to add cross reference stack-overflow link here as well. edited the original post to include the cross ref link
thumbnail
Olaf Kock, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
But this can lead to some performance concern?


Have you measured? If not, it's irrelevant. If you have measured: Optimize the first bottleneck that you find. If you can gain 20% with another setting but only 0.5% with changing the counter.increment: Don't bother. If your measurement shows you that Liferay (or the database) is spending a lot of time generating primary keys, it might be a choice to modify this value. Don't optimize before you're reasonably sure that there's a bottleneck.

If your portal is rather read-oriented, nobody will even consider to touch this value. "As per Liferay it is recommended" - where did you find this recommendation? If it was a blank subscription, I'd counter it. I assume that there is some condition attached.
thumbnail
Ankit Pancholi, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Junior Member Beiträge: 78 Beitrittsdatum: 07.01.10 Neueste Beiträge
Olaf Kock:
But this can lead to some performance concern?

If your portal is rather read-oriented, nobody will even consider to touch this value. "As per Liferay it is recommended" - where did you find this recommendation? If it was a blank subscription, I'd counter it. I assume that there is some condition attached.


It was just a question, so Liferay experts can share there experience about the issue and possible solution. But if there is this issue on Clustering configuration I was unable to find much information on same.
My Portal is not read-oriented only. The property itself have the description stating "Set this value to a higher number for better performance." But no where mentioning to keep the value as 1 in clustering to avoid caching issue.

However I tested by setting the property to counter.increment=1 it solves the problem.
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Ankit Pancholi:
But this can lead to some performance concern ? As per liferay it is recommended to give higher value to counter.increment


Performance is important, but you should not sacrifice stability for the sake of it. If a counter increment of 1 allows everything to work, isn't that better than a perceived performance impact?
thumbnail
Ankit Pancholi, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Junior Member Beiträge: 78 Beitrittsdatum: 07.01.10 Neueste Beiträge
David H Nebinger:

Performance is important, but you should not sacrifice stability for the sake of it. If a counter increment of 1 allows everything to work, isn't that better than a perceived performance impact?


Thanks David, I agree.
thumbnail
Olaf Kock, geändert vor 8 Jahren.

RE: BatchUpdateException: Batch entry 0 insert into LayoutSet

Liferay Legend Beiträge: 6403 Beitrittsdatum: 23.09.08 Neueste Beiträge
As you don't crossreference stackoverflow yourself, here's the reference.

See - it's for a reason: One side gets answered while the other hasn't gathered attention right now. Without crossreference somebody else might repeat the work that's already been done here.