title: Liferay portal 6.2 Errror - Could not execute JDBC batch update; SQL [insert into DLFileRank -
body: <p>In  Linux Centos, I started up my liferay portal 6.2 ce-ga2. Every things were okay, but I saw these erorrs in catalina.out log file:</p>
  
  <pre><code>    23:31:05,917 ERROR [http-bio-80-exec-404][status_jsp:750] org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into DLFileRank (groupId, companyId, userId, createDate, fileEntryId, active_, fileRankId) values (?, ?, ?, ?, ?, ?, ?)]; constraint ; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
  org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into DLFileRank (groupId, companyId, userId, createDate, fileEntryId, active_, fileRankId) values (?, ?, ?, ?, ?, ?, ?)]; constraint ; 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.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
  at com.sun.proxy.$Proxy199.getFileAsStream(Unknown Source)
  at com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil.getFileAsStream(DLFileEntryLocalServiceUtil.java:553)
  at com.liferay.portlet.documentlibrary.model.impl.DLFileVersionImpl.getContentStream(DLFileVersionImpl.java:54)
  at com.liferay.portal.repository.liferayrepository.model.LiferayFileVersion.getContentStream(LiferayFileVersion.java:116)
  at com.liferay.portal.webserver.WebServerServlet.sendFile(WebServerServlet.java:986)
  at com.liferay.portal.webserver.WebServerServlet.service(WebServerServlet.java:259)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  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.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:46)
  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.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:263)
  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.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
  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.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
  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.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:297)
  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.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:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:745)
  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)
  ... 70 more
  Caused by: java.sql.BatchUpdateException: Duplicate entry '10157-37238-102948' for key 'IX_38F0315'
  at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2054)
  at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467)
  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)
  ... 78 more
  Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '10157-37238-102948' for key 'IX_38F0315'
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.Util.getInstance(Util.java:386)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794)
  at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2458)
  at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
  ... 82 more
  </code></pre>
  
  <p>How can I solve this issue?</p>
  
  <p>Although I set this variablese in setenv.sh :</p>
  
  <pre><code>    CATALINA_OPTS="$CATALINA_OPTS -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true  -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false -Duser.timezone=GMT -Xms1024m -Xmx5110m -XX:MaxPermSize=256m"
  
  export JRE_HOME="/usr/java/jdk1.7.0_79/jre/"
  export JAVA_OPTS="-Xmx4096m -Xms2048m -XX:+HeapDumpOnOutOfMemoryError -XX:MaxPermSize=512m"
  </code></pre>
  
  <p>But I don't know where in liferay portal causes to happenning this event!!!!!!</p>
  
  <p>Please guide me.</p>
  
  <p>Thanks</p>