title: Jar service needs restart to work again if data insertion in MC access db raises an error
body: <p>I'm running a spring boot application (APIs with html) as a jar service.</p>
  <p>I have the following code, where I add data to MS Access database.</p>
  <pre><code>private JdbcTemplate template; 
  /* my extra code*/
  try {
                   insert = template.update(&quot;INSERT INTO tblE125Details (ForeasCode, EYear, ArProtokolou, InvNo, SName, Fname, DOB, sex, IDno, entipo, EKAANo,&quot;
                      + &quot;EKAAIssueDate, EKAAExpireDate, PaymentAmount, PaymentCurrency, HospFrom, HospTo)&quot;
                      + &quot; VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)&quot;,
                       institutionID.substring(0,2), ProvidedBenefits_BenefitsPeriod_startDate.substring(0,4), 
                       globalCLAReferenceCreditorLiaisonBody, individualCLANumberCreditorLiaisonBody,familyName, 
                       forename, dateBirth, sexDescription, pINPersonInCompetentMemberState,db_entipo, eHICNumber, db_EKAAIssueDate, db_EKAAExpireDate, 
                       TotalIndividualAmountBenefits_amount, TotalIndividualAmountBenefits_currency,
                       ProvidedBenefits_BenefitsPeriod_startDate, ProvidedBenefits_BenefitsPeriod_endDate);
               }
               catch (InvalidResultSetAccessException e) 
               {
                   throw new RuntimeException(e);
               } 
               catch (DataAccessException e)
               {
                   throw new RuntimeException(e);
               }
  </code></pre>
  <p>However, when an error occurs, I need to restart the jar file. Is there any solution to force my service to run, even though an error occurred previously?</p>
  <p>This is an error I had and my service need to restart in order to work:</p>
  <pre><code>2022-02-22 09:34:21.673 ERROR 12536 --- [http-nio-8091-exec-4] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/eessi] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO tblE125Details (ForeasCode, EYear, ArProtokolou, InvNo, SName, Fname, DOB, sex, IDno, entipo, EKAANo,EKAAIssueDate, EKAAExpireDate, PaymentAmount, PaymentCurrency, HospFrom, HospTo) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; UCAExc:::4.0.4 data exception: string data, right truncation;  table: TBLE125DETAILS column: INVNO; nested exception is net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.4 data exception: string data, right truncation;  table: TBLE125DETAILS column: INVNO] with root cause
  
  org.hsqldb.HsqlException: data exception: string data, right truncation
      at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.types.CharacterType.convertToTypeLimits(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.Table.enforceTypeLimits(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.Table.generateAndCheckData(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.Table.insertSingleRow(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.StatementDML.insertSingleRow(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.StatementInsert.getResult(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.StatementDMQL.execute(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.Session.executeCompiledStatement(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.Session.execute(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.jdbc.JDBCPreparedStatement.fetchResult(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at org.hsqldb.jdbc.JDBCPreparedStatement.executeUpdate(Unknown Source) ~[hsqldb-2.5.1.jar!/:2.5.1]
      at net.ucanaccess.jdbc.ExecuteUpdate.executeWrapped(ExecuteUpdate.java:63) ~[ucanaccess-4.0.4.jar!/:4.0.4]
      at net.ucanaccess.jdbc.AbstractExecute.executeBase(AbstractExecute.java:264) ~[ucanaccess-4.0.4.jar!/:4.0.4]
      at net.ucanaccess.jdbc.ExecuteUpdate.execute(ExecuteUpdate.java:48) ~[ucanaccess-4.0.4.jar!/:4.0.4]
      at net.ucanaccess.jdbc.UcanaccessPreparedStatement.executeUpdate(UcanaccessPreparedStatement.java:266) ~[ucanaccess-4.0.4.jar!/:4.0.4]
      at org.springframework.jdbc.core.JdbcTemplate.lambda$update$2(JdbcTemplate.java:965) ~[spring-jdbc-5.3.3.jar!/:5.3.3]
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651) ~[spring-jdbc-5.3.3.jar!/:5.3.3]
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:960) ~[spring-jdbc-5.3.3.jar!/:5.3.3]
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1015) ~[spring-jdbc-5.3.3.jar!/:5.3.3]
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1025) ~[spring-jdbc-5.3.3.jar!/:5.3.3]
      at mlsi.gov.cy.ctr.ImportE125Controller.getE125New(ImportE125Controller.java:311) ~[classes!/:0.0.1-SNAPSHOT]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
      at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1060) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:665) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.3.jar!/:5.3.3]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.3.jar!/:5.3.3]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.41.jar!/:9.0.41]
      at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
  </code></pre>
  <p><strong>Edit:</strong> I found why the error occurred, but I need to handle any other error may appear and make sure that the service will continue to work.</p>