Page 1 of 1

Could not execute JDBC batch update

PostPosted:Thu Aug 28, 2014 8:06 am
by Fohnbit
Hello!

OKM is running now 1 week and today I get the error:
"Could not execute JDBC batch update"

when I click "force user mail import".

Yesterday it works fine.

I add yesterday a second account and there was a lot of mails do downloading.

Where is the problem? Need help!

Thank you!

Found this in log:
Code: Select all
com.openkm.core.DatabaseException: Could not execute JDBC batch update
        at com.openkm.dao.NodeMailDAO.create(NodeMailDAO.java:106)
        at com.openkm.module.db.base.BaseMailModule.create(BaseMailModule.java:139)
        at com.openkm.module.db.DbMailModule.create(DbMailModule.java:123)
        at com.openkm.util.MailUtils.importMail(MailUtils.java:801)
        at com.openkm.util.MailUtils.importMessages(MailUtils.java:607)
        at com.openkm.core.UserMailImporter.runAs(UserMailImporter.java:95)
        at com.openkm.core.UserMailImporter.run(UserMailImporter.java:66)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at bsh.Reflect.invokeMethod(Reflect.java:134)
        at bsh.Reflect.invokeObjectMethod(Reflect.java:80)
        at bsh.BSHPrimarySuffix.doName(BSHPrimarySuffix.java:176)
        at bsh.BSHPrimarySuffix.doSuffix(BSHPrimarySuffix.java:120)
        at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:80)
        at bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:47)
        at bsh.Interpreter.eval(Interpreter.java:645)
        at bsh.Interpreter.eval(Interpreter.java:739)
        at bsh.Interpreter.eval(Interpreter.java:728)
        at com.openkm.util.ExecutionUtils.runScript(ExecutionUtils.java:112)
        at com.openkm.core.Cron$RunnerBsh.run(Cron.java:103)
        at com.openkm.servlet.admin.CronTabServlet.execute(CronTabServlet.java:230)
        at com.openkm.servlet.admin.CronTabServlet.doGet(CronTabServlet.java:116)
        at com.openkm.servlet.admin.CronTabServlet.service(CronTabServlet.java:72)
        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 org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        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 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.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
        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.DataException: Could not execute JDBC batch update
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:114)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2420)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2875)
        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
        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 com.openkm.dao.HibernateUtil.commit(HibernateUtil.java:303)
        at com.openkm.dao.NodeMailDAO.create(NodeMailDAO.java:90)
        ... 67 more
Caused by: java.sql.BatchUpdateException: data exception: string data, right truncation
        at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(Unknown Source)
        at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
        at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
        ... 82 more

Re: Could not execute JDBC batch update

PostPosted:Fri Aug 29, 2014 4:11 pm
by jllort
The class what is causing the problem is NodeMailDAO you can take a look here https://sourceforge.net/p/openkm/code/H ... ilDAO.java

Error only indicate that can not doing update but not the sql reason for what is not possible ( probably you're using HSQL -> embeded database, with MySQL or PostgreSQL we should get more information about the reasons why is not possible ). Seems of the mails you're importing does not like to the query, but without the mail or debugging is quite difficult to discover the reason. I do not know if you're on HSQL, I supposed, if it's your case I suggest move to MySQL or PostGreSQL for production environment.

The easiest way is to identify the mail in queue is procesed and take a look about what happens with it. If you can provide in msg or eml format we can take a look on possible reason why is not going right.

Re: Could not execute JDBC batch update

PostPosted:Fri Aug 29, 2014 8:17 pm
by Fohnbit
I found the Problem email.
It was a spam with a very long subject.

I delete the mail on the Server and now he is downloading.

Re: Could not execute JDBC batch update

PostPosted:Sat Aug 30, 2014 6:06 am
by Fohnbit
Hello again!

I found also other spam mails, where I get an error if OKM will downloading.
I attached this spam here.

It will good, if there is an error while downloading, that he skip the mail and proceed with the next?

Re: Could not execute JDBC batch update

PostPosted:Sun Aug 31, 2014 11:16 am
by pavila
I've commited a fix for this problem with very long subjects.

Wait for the night build and test.

Re: Could not execute JDBC batch update

PostPosted:Mon Sep 01, 2014 10:12 am
by Fohnbit
Not sure if possible, but will be good, if there is an error, that he skip this mail and proceed with the rest.

Re: Could not execute JDBC batch update

PostPosted:Mon Sep 01, 2014 11:10 am
by pavila
To improve the import performance, we read from the last mail uuid (in case of IMAP). If we ignore an email, it won't be imported next time because its uuid is minor than the last imported one. IMAP uuids are supposed to be sequential.

Re: Could not execute JDBC batch update

PostPosted:Fri Mar 11, 2016 10:28 am
by hnoor0044
thinks for sharing information