Transactional problem after migrating Hibernate from 3 to 4 - java

The problem
I've migrated from Hibernate 3.6.10 to 4.3.11. These are my pom.xml properties:
<!--<hibernate.version>3.6.10.Final</hibernate.version>-->
<hibernate.version>4.3.11.Final</hibernate.version>
I'm working with legacy code and I've got a service method like this:
public Collection<ProtExtraccionMuestra> guardarProtExtraccionMuestras(
Collection<ProtExtraccionMuestra> protExtraccionMuestras) {
Date fechaEntrada = null;
Date fechaSalida = null;
Collection<ProtExtraccionMuestra> muestrasRetornar = new HashSet<ProtExtraccionMuestra>();
if (protExtraccionMuestras != null) {
for (ProtExtraccionMuestra protExtraccionMuestra : protExtraccionMuestras) {
Localizador.servMuestra().comprobarMuestraEnBiobanco(protExtraccionMuestra.getMuestra());
fechaEntrada = protExtraccionMuestra.getMuestra().getFechaEntrada();
fechaSalida = protExtraccionMuestra.getMuestra().getFechaSalida();
protExtraccionMuestra = (ProtExtraccionMuestra) guardar(protExtraccionMuestra, true);
protocoloExtraccionService.comprobarEstadoMuestra(protExtraccionMuestra.getMuestra(), fechaEntrada, fechaSalida);
muestrasRetornar.add(protExtraccionMuestra);
}
}
return muestrasRetornar;
}
After upgrading, the code didn't work. I got this error (HibernateException: Could not obtain transaction-synchronized Session for current thread):
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) [ERROR,ExceptionControllerAdvice,http-/127.0.0.1:63724-1] EXCEPTION TRACE:
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at es.gva.san.fisabio.rvb.HibernateDAO.getSession(HibernateDAO.java:31)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at es.gva.san.fisabio.rvb.HibernateDAO.merge(HibernateDAO.java:59)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at util.hibernate.DiUtilHibernate.merge(DiUtilHibernate.java:166)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at service.AbstractService.modificar(AbstractService.java:1052)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at service.GenericCRUDSImpl.guardar(GenericCRUDSImpl.java:110)
10:32:54,135 INFO [stdout] (http-/127.0.0.1:63724-1) at es.di.biobanco.csisp.laboratorio.service.ProtExtraccionMuestraServiceImpl.guardarProtExtraccionMuestras(ProtExtraccionMuestraServiceImpl.java:78)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at java.lang.reflect.Method.invoke(Method.java:498)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at com.sun.proxy.$Proxy58.guardarProtExtraccionMuestras(Unknown Source)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at es.gva.san.fisabio.rvb.controller.LaboratorioController.guardarProtExtraccionMuestras(LaboratorioController.java:128)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at es.gva.san.fisabio.rvb.controller.LaboratorioController$$FastClassBySpringCGLIB$$7fedee67.invoke(<generated>)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at es.gva.san.fisabio.rvb.controller.LaboratorioController$$EnhancerBySpringCGLIB$$b9797364.guardarProtExtraccionMuestras(<generated>)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at java.lang.reflect.Method.invoke(Method.java:498)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
10:32:54,136 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:220)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:197)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
10:32:54,139 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
10:32:54,140 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
10:32:54,141 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
10:32:54,141 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
10:32:54,141 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
10:32:54,142 INFO [stdout] (http-/127.0.0.1:63724-1) at java.lang.Thread.run(Thread.java:745)
So I've made it transactional with #Transactional decorator.
Then I have the following error (InvalidDataAccessApiUsageException: object references an unsaved transient instance):
16:50:05,587 ERROR es.gva.san.fisabio.rvb.controller.advice.ExceptionControllerAdvice,http-/0.0.0.0:63004-6:41 - EXCEPTION TRACE:
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing: es.di.biobanco.csisp.laboratorio.entity.ProtocoloExtraccion; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: es.di.biobanco.csisp.laboratorio.entity.ProtocoloExtraccion
at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:190)
at org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)
at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:504)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:292)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at es.gva.san.fisabio.rvb.controller.LaboratorioController$$EnhancerBySpringCGLIB$$432cae2f.guardarProtExtraccionMuestras(<generated>)
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.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:220)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:220)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: es.di.biobanco.csisp.laboratorio.entity.ProtocoloExtraccion
at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:294)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:537)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:311)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:321)
at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:310)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4243)
at org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:546)
at org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:232)
at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:159)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:231)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:102)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:55)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1258)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177)
at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)
... 76 more
More data and code
This is the way objects are saved, after some validations:
In some heir of AbstractEntity:
public AbstractEntity guardar(AbstractEntity entity,boolean merge) {
return super.modify(entity, merge);
}
public HibernateDAO getHibernateTemplate() {
return this;
}
[...]
public AbstractEntity modify(AbstractEntity obj, boolean merge) {
if (!merge) {
try {
this.getHibernateTemplate().saveOrUpdate(obj);
} catch (Exception e) {
logger.error(e);
obj = DiUtilHibernate.merge(obj, getSession());
this.getHibernateTemplate().saveOrUpdate(obj);
}
} else {
obj = DiUtilHibernate.merge(obj, this.getHibernateTemplate());
}
return obj;
}
And this awful utility class:
/**
* Merge function, to load only the required entities
*/
public static AbstractEntity merge(AbstractEntity ent, Session ses) {
// We save the values, before they are lost with the merge
String lazysCargados = ent.getLazysCargados();
boolean valorLazys = ent.getCargarLazysProxy();
return afterMerge((AbstractEntity) ses.merge(ent), lazysCargados, valorLazys);
}
Please let me know if you need some other piece of code or clarification.

Related

Spring Security Acl object

My service to create Acl is like this:
#Autowired
JdbcMutableAclService aclService;
public void createAcl(AclDTO aclDTO) throws ClassNotFoundException {
ObjectIdentity oi = new ObjectIdentityImpl(getClass().getClassLoader().loadClass(aclDTO.getClassPath()),
aclDTO.getObjectIdentityId());
Sid sid = new PrincipalSid(aclDTO.getSid());
Permission p = getPermission(aclDTO.getPermissionDesc());
// Create or update the relevant ACL
MutableAcl acl = null;
try {
acl = (MutableAcl) this.aclService.readAclById(oi);
} catch (NotFoundException nfe) {
acl = aclService.createAcl(oi);
}
// Now grant some permissions via an access control entry (ACE)
acl.insertAce(acl.getEntries().size(), p, sid, true);
this.aclService.updateAcl(acl);
}
But it seems something wrong with this class and when it runs, I got the error like this:
2019-02-25 11:02:18.410 ERROR 10608 --- [ XNIO-2 task-1] c.s.s.acl.aop.logging.LoggingAspect : Exception in com.spring.security.acl.service.AccessGrantService.createAcl() with cause = 'com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: PROCEDURE security_acl.identity does not exist' and exception = 'StatementCallback; bad SQL grammar [call identity()]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: PROCEDURE security_acl.identity does not exist'
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [call identity()]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: PROCEDURE security_acl.identity does not exist
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1398)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:388)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:446)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:467)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:474)
at org.springframework.security.acls.jdbc.JdbcMutableAclService.createOrRetrieveSidPrimaryKey(JdbcMutableAclService.java:262)
at org.springframework.security.acls.jdbc.JdbcMutableAclService.createOrRetrieveSidPrimaryKey(JdbcMutableAclService.java:237)
at org.springframework.security.acls.jdbc.JdbcMutableAclService.createObjectIdentity(JdbcMutableAclService.java:171)
at org.springframework.security.acls.jdbc.JdbcMutableAclService.createAcl(JdbcMutableAclService.java:118)
at com.spring.security.acl.service.AccessGrantService.createAcl(AccessGrantService.java:37)
at com.spring.security.acl.service.AccessGrantService$$FastClassBySpringCGLIB$$8f8e3af4.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.spring.security.acl.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
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:497)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at com.spring.security.acl.service.AccessGrantService$$EnhancerBySpringCGLIB$$802d4181.createAcl()
at com.spring.security.acl.web.rest.AclResource.updateAcl(AclResource.java:24)
at com.spring.security.acl.web.rest.AclResource$$FastClassBySpringCGLIB$$bf5f9ed6.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:746)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)
at com.spring.security.acl.aop.logging.LoggingAspect.logAround(LoggingAspect.java:85)
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:497)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
at com.spring.security.acl.web.rest.AclResource$$EnhancerBySpringCGLIB$$8e0281d5.updateAcl()
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:497)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:981)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:884)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:858)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at com.spring.security.acl.security.jwt.JWTFilter.doFilter(JWTFilter.java:38)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117)
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:65)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:336)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: PROCEDURE security_acl.identity does not exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2449)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1381)
at com.zaxxer.hikari.pool.ProxyStatement.executeQuery(ProxyStatement.java:111)
at com.zaxxer.hikari.pool.HikariProxyStatement.executeQuery(HikariProxyStatement.java)
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:433)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:376)
... 164 common frames omitted
I'll appreciate if someone can help me deal with this!
It seem that you are using MySQL.
I had the same error and resolved it by setting up the JdbcMutableAclService as below:
// Based on https://github.com/eugenp/tutorials/blob/master/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java
#Bean
public JdbcMutableAclService aclService() {
JdbcMutableAclService jdbcMutableAclService = new JdbcMutableAclService(dataSource, lookupStrategy(), aclCache());
// TODO: for MySQL ONLY
jdbcMutableAclService.setClassIdentityQuery("SELECT ##IDENTITY");
jdbcMutableAclService.setSidIdentityQuery("SELECT ##IDENTITY");
return jdbcMutableAclService;
}
Hope this help.
Solution for PostgreSQL when use JdbcMutableAclService:
#Bean
public MutableAclService aclService() {
JdbcMutableAclService aclService = new JdbcMutableAclService(dataSource, lookupStrategy(), aclCache());
aclService.setSidIdentityQuery("SELECT currval('acl_sid_id_seq')");
aclService.setClassIdentityQuery("SELECT currval('acl_class_id_seq')");
return aclService;
}

org.apache.poi.xwpf.converter.core.XWPFConverterException: java.lang.NullPointerException (Java)

I am getting conversion error while converting docx to pdf.
This is my code:
private File convertFileToPdf(MultipartFile file) {
try {
File docFile = new File(file.getOriginalFilename());
String extension =
FilenameUtils.getExtension(file.getOriginalFilename());
File pdfFile = new
File(file.getOriginalFilename().replace(extension, "pdf"));
log.debug(file.getOriginalFilename());
docFile.createNewFile();
InputStream doc = new FileInputStream(docFile);
XWPFDocument document = new XWPFDocument(doc);
PdfOptions options = PdfOptions.create();
OutputStream out = new FileOutputStream(pdfFile);
PdfConverter.getInstance().convert(document, out, options);
return pdfFile;
} catch (Exception e) {
log.error("exception while converting file to pdf", e);
return null;
}
}
Added dependencies are:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.13</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.13</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
<version>1.0.5</version>
</dependency>
Exception is:
org.apache.poi.xwpf.converter.core.XWPFConverterException: java.lang.NullPointerException
at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:70)
at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:38)
at org.apache.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:45)
at com.vfirstt.nexttrophy.blog.service.BlogService.convertFileToPdf(BlogService.java:1622)
at com.vfirstt.nexttrophy.blog.service.BlogService.uploadImageCdn(BlogService.java:1519)
at com.vfirstt.nexttrophy.blog.service.BlogService$$FastClassBySpringCGLIB$$a46b5218.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at com.vfirstt.nexttrophy.blog.service.BlogService$$EnhancerBySpringCGLIB$$bcc1f4a6.uploadImageCdn(<generated>)
at com.vfirstt.nexttrophy.blog.web.rest.api.adapter.BlogResourceImpl.uploadImageCdn(BlogResourceImpl.java:146)
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.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:111)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:332)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812)
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: java.lang.NullPointerException: null
at org.apache.poi.xwpf.converter.core.styles.run.RunUnderlineValueProvider.getValue(RunUnderlineValueProvider.java:40)
at org.apache.poi.xwpf.converter.core.styles.run.RunUnderlineValueProvider.getValue(RunUnderlineValueProvider.java:31)
at org.apache.poi.xwpf.converter.core.styles.run.AbstractRunValueProvider.getValueFromElement(AbstractRunValueProvider.java:76)
at org.apache.poi.xwpf.converter.core.styles.run.AbstractRunValueProvider.getValueFromElement(AbstractRunValueProvider.java:44)
at org.apache.poi.xwpf.converter.core.styles.AbstractValueProvider.internalGetValue(AbstractValueProvider.java:50)
at org.apache.poi.xwpf.converter.core.styles.AbstractValueProvider.getValue(AbstractValueProvider.java:41)
at org.apache.poi.xwpf.converter.core.styles.XWPFStylesDocument.getUnderline(XWPFStylesDocument.java:692)
at org.apache.poi.xwpf.converter.pdf.internal.PdfMapper.visitRun(PdfMapper.java:475)
at org.apache.poi.xwpf.converter.pdf.internal.PdfMapper.visitRun(PdfMapper.java:111)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitRuns(XWPFDocumentVisitor.java:616)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitParagraphBody(XWPFDocumentVisitor.java:441)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitParagraph(XWPFDocumentVisitor.java:332)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.visitBodyElements(XWPFDocumentVisitor.java:247)
at org.apache.poi.xwpf.converter.core.XWPFDocumentVisitor.start(XWPFDocumentVisitor.java:199)
at org.apache.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:56)
... 126 common frames omitted
This converts some docx file to pdf but sometimes it gives exception while converting to pdf.
I get exception at PdfConverter.getInstance().convert(xwpfDocument, out, options); line.
Please help me with this.
Thanks in advance.
I believe
org.apache.poi.xwpf.converter.core.styles.run.RunUnderlineValueProvider.getValue(RunUnderlineValueProvider.java:40)
this is the cause as converter trying to read style string it might be getting null. If you are manipulating the xwpfdocument you should take care of it programmatically.

Exception Handler in Spring boot not working?

I am implementing global error handling in my project using Spring boot. I am throwing a "ResourceNotFoundException" when my "Customer" object is "null". But the Spring exception handler is not catching it.
My RestController class:
#RestController
#Path("/customer")
public class CustomerEndpoint {
private static final Logger LOGGER = LoggerFactory.getLogger(CustomerEndpoint.class);
#Autowired
private ICustomerService customerService;
#GET
#Path("/{id}")
#Produces(MediaType.APPLICATION_JSON)
public Response getCustomerById(#PathParam("id") Integer id) throws ResourceNotFoundException {
CustomerVO article = customerService.getCustomerById(id);
if (article == null) {
throw new ResourceNotFoundException(customerId, "Customer not found");
}
return Response.ok(article).build();
}
}
My ExceptionHandler:
#ControllerAdvice
public class GlobalExceptionHandlerController extends ResponseEntityExceptionHandler {
#ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity<ExceptionResponse> resourceNotFound(ResourceNotFoundException ex) {
ExceptionResponse response = new ExceptionResponse();
response.setErrorCode("resource not found");
response.setErrorMessage(ex.getMessage());
return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
}
}
ExceptionResponse:
public class ExceptionResponse {
private String errorCode;
private String errorMessage;
public ExceptionResponse() {
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
}
ResourceNotFoundException class:
public class ResourceNotFoundException extends RuntimeException{
private long resourceId;
private String message;
public ResourceNotFoundException(long resourceId, String message) {
super(message);
this.resourceId = resourceId;
this.message = message;
}
public ResourceNotFoundException(String message) {
super(message);
this.message = message;
}
#Override
public String getMessage() {
return message;
}
}
Please observe the RestController class. When I get a request for a customer with an id , if the customer is not present it throws ResourceNotFound exception. By default this needs to be catched by the ExceptionHandler. But instead of this I am getting the stackTrace like following. Please help me in catching this exception globally.
com.finsol.qunatotrade.exception.ResourceNotFoundException: Customer not found
at com.finsol.qunatotrade.service.CustomerService.getCustomerById(CustomerService.java:50) ~[classes/:na]
at com.finsol.qunatotrade.service.CustomerService$$FastClassBySpringCGLIB$$5c04d986.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) ~[spring-aop-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at com.finsol.qunatotrade.service.CustomerService$$EnhancerBySpringCGLIB$$ddc81d1f.getCustomerById(<generated>) ~[classes/:na]
at com.finsol.qunatotrade.api.endpoint.CustomerEndpoint.getCustomerById(CustomerEndpoint.java:50) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144]
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[jersey-common-2.25.1.jar:na]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[jersey-common-2.25.1.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[jersey-common-2.25.1.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[jersey-common-2.25.1.jar:na]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[jersey-common-2.25.1.jar:na]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[jersey-common-2.25.1.jar:na]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[jersey-server-2.25.1.jar:na]
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ~[jersey-container-servlet-core-2.25.1.jar:na]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[jersey-container-servlet-core-2.25.1.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[jersey-container-servlet-core-2.25.1.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[jersey-container-servlet-core-2.25.1.jar:na]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[jersey-container-servlet-core-2.25.1.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at com.finsol.qunatotrade.api.filter.CORSFilter.doFilter(CORSFilter.java:34) ~[classes/:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar:8.5.23]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar:8.5.23]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar:8.5.23]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
2018-01-29 17:37:20.264 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing servlet 'dispatcherServlet'
2018-01-29 17:37:20.265 INFO 2304 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-01-29 17:37:20.266 INFO 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-01-29 17:37:20.266 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Using MultipartResolver [org.springframework.web.multipart.support.StandardServletMultipartResolver#13ba49b5]
2018-01-29 17:37:20.274 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Unable to locate LocaleResolver with name 'localeResolver': using default [org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver#18ee3eeb]
2018-01-29 17:37:20.280 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Unable to locate ThemeResolver with name 'themeResolver': using default [org.springframework.web.servlet.theme.FixedThemeResolver#583d7e84]
2018-01-29 17:37:20.289 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Unable to locate RequestToViewNameTranslator with name 'viewNameTranslator': using default [org.springframework.web.servlet.view.DefaultRequestToViewNameTranslator#6611f464]
2018-01-29 17:37:20.303 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Unable to locate FlashMapManager with name 'flashMapManager': using default [org.springframework.web.servlet.support.SessionFlashMapManager#29de5bb4]
2018-01-29 17:37:20.303 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Published WebApplicationContext of servlet 'dispatcherServlet' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcherServlet]
2018-01-29 17:37:20.303 INFO 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 37 ms
2018-01-29 17:37:20.303 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Servlet 'dispatcherServlet' configured successfully
2018-01-29 17:37:20.305 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/error]
2018-01-29 17:37:20.310 DEBUG 2304 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /error
2018-01-29 17:37:20.330 DEBUG 2304 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)]
2018-01-29 17:37:20.331 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Last-Modified value for [/error] is: -1
2018-01-29 17:37:20.451 DEBUG 2304 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Written [{timestamp=Mon Jan 29 17:37:20 IST 2018, status=500, error=Internal Server Error, exception=com.finsol.qunatotrade.exception.ResourceNotFoundException, message=Customer not found, path=/qtregistration/customer/1}] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter#6344227]
2018-01-29 17:37:20.452 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2018-01-29 17:37:20.452 DEBUG 2304 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Successfully completed request
enter code here
As already mentioned, #ControllerAdvice cannot be used for Jersey. You can use ExceptionMapper with the annotation #Provider that maps Java exceptions to Jersey response.
The ExceptionHandler:
#Provider
public class GlobalExceptionHandlerController implements ExceptionMapper<ResourceNotFoundException> {
#Override
public Response toResponse(ResourceNotFoundException e) {
ExceptionResponse response = new ExceptionResponse();
response.setErrorCode("resource not found");
response.setErrorMessage(e.getMessage());
return Response.status(404).entity(response)
.type("application/json").build();
}
}
Don't forget to register this GlobalExceptionHandlerController just like your CustomerEndpoint:
#Configuration
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() {
register(GlobalExceptionHandlerController.class);
register(CustomerEndpoint.class); // your existing controller
}
}
It seems that GlobalExceptionHandlerController is NOT visible to spring. See how are doing it for service classes. If GlobalExceptionHandlerController is under a package which is getting scanned alright, then you could try this code instead:
#Provider
public class ErrorResponseHandler implements ExceptionMapper<Throwable>{
private static final Logger logger = LoggerFactory.getLogger(ErrorResponseHandler.class);
#Override
public Response toResponse(Throwable error) {
if (error instanceof ResourceNotFoundException) {
....
....
}
else if (error instanceof JsonProcessingException) {
logger.error("Could not interpret incoming request", error);
return Response.status(Response.Status.BAD_REQUEST).entity(error.getMessage()).build();
}
else{
return response;
}
}
}

Item deleted from database but still appearing

I'm trying to make my application thread safe, so I have:
companyManagment.deleteQuestionToQuestionnaire(questions_assigned_to_questionnaires_id);
#Override
#Transactional
public synchronized void deleteQuestionToQuestionnaire(Long questions_assigned_to_questionnaires_id) {
String methodname = " " + Thread.currentThread().getName() + " deleteQuestionToQuestionnaire ";
logger.info(methodname + " questions_assigned_to_questionnaires_id["+ (questions_assigned_to_questionnaires_id!=null?questions_assigned_to_questionnaires_id.toString():null) +"]");
QuestionsAssignedToQuestionnaires questionsAssignedToQuestionnairesInDatabase = getQuestionsAssignedToQuestionnaires(questions_assigned_to_questionnaires_id);
if(questionsAssignedToQuestionnairesInDatabase != null) {
logger.info(methodname + " questionsAssignedToQuestionnairesInDatabase != null");
questionsAssignedToQuestionnairesRepository.delete(questions_assigned_to_questionnaires_id);
} else {
logger.info(methodname + " questionsAssignedToQuestionnairesInDatabase == null");
}
}
I have Mysql on my local server. When 2 requests sent to the server, I put a break point on the fist line in the deleteQuestionToQuestionnaire() method. The problem is that JPA does not see that the row has been deleted.
I'm using a link to pass up the information I want to delete so it's easy for me to click that a few times. Could this be the problem?
Anyway, I have the logs:
2016-01-10 10:44:19.667 INFO 9880 --- [nio-8080-exec-8] data.service.CompanyManagmentImpl : http-nio-8080-exec-8 deleteQuestionToQuestionnaire questions_assigned_to_questionnaires_id[56]
2016-01-10 10:44:19.669 INFO 9880 --- [nio-8080-exec-8] data.service.CompanyManagmentImpl : http-nio-8080-exec-8 deleteQuestionToQuestionnaire questionsAssignedToQuestionnairesInDatabase != null
2016-01-10 10:44:19.688 INFO 9880 --- [nio-8080-exec-5] data.service.CompanyManagmentImpl : http-nio-8080-exec-5 deleteQuestionToQuestionnaire questions_assigned_to_questionnaires_id[56]
2016-01-10 10:44:19.689 INFO 9880 --- [nio-8080-exec-5] data.service.CompanyManagmentImpl : http-nio-8080-exec-5 deleteQuestionToQuestionnaire questionsAssignedToQuestionnairesInDatabase != null
2016-01-10 10:44:19.691 INFO 9880 --- [nio-8080-exec-4] data.service.CompanyManagmentImpl : http-nio-8080-exec-4 deleteQuestionToQuestionnaire questions_assigned_to_questionnaires_id[56]
2016-01-10 10:44:19.697 INFO 9880 --- [nio-8080-exec-4] data.service.CompanyManagmentImpl : http-nio-8080-exec-4 deleteQuestionToQuestionnaire questionsAssignedToQuestionnairesInDatabase != null
2016-01-10 10:44:19.735 INFO 9880 --- [nio-8080-exec-3] data.service.CompanyManagmentImpl : http-nio-8080-exec-3 deleteQuestionToQuestionnaire questions_assigned_to_questionnaires_id[56]
2016-01-10 10:44:19.764 INFO 9880 --- [nio-8080-exec-4] o.h.e.j.b.internal.AbstractBatchImpl : HHH000010: On release of batch it still contained JDBC statements
2016-01-10 10:44:19.811 INFO 9880 --- [nio-8080-exec-5] tAssignedQuestionsToQuestionnaireWrapper : Removing QuestionDraw[3] from mapAllQuestionDrawsForCompany
2016-01-10 10:44:19.812 INFO 9880 --- [nio-8080-exec-8] o.h.e.j.b.internal.AbstractBatchImpl : HHH000010: On release of batch it still contained JDBC statements
2016-01-10 10:44:19.839 INFO 9880 --- [nio-8080-exec-3] data.service.CompanyManagmentImpl : http-nio-8080-exec-3 deleteQuestionToQuestionnaire questionsAssignedToQuestionnairesInDatabase != null
2016-01-10 10:44:19.846 INFO 9880 --- [nio-8080-exec-5] tAssignedQuestionsToQuestionnaireWrapper : Removing QuestionYesNo[5] from mapAllQuestionYesNosForCompany
2016-01-10 10:44:19.860 INFO 9880 --- [nio-8080-exec-3] o.h.e.j.b.internal.AbstractBatchImpl : HHH000010: On release of batch it still contained JDBC statements
2016-01-10 10:44:19.889 ERROR 9880 --- [nio-8080-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.ObjectOpt
imisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected:
1] with root cause
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:81)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73)
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:63)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3400)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3630)
at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:114)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:465)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:351)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1258)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:177)
at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:77)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy93.deleteQuestionToQuestionnaire(Unknown Source)
at controler.CompanyAdminController.assignQuestionsToQuestionnaire(CompanyAdminController.java:1478)
at controler.CompanyAdminController$$FastClassBySpringCGLIB$$b1a0a1d2.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:68)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at controler.CompanyAdminController$$EnhancerBySpringCGLIB$$3e616d1e.assignQuestionsToQuestionnaire(<generated>)
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.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:168)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1521)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1478)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
2016-01-10 10:44:19.894 ERROR 9880 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.ObjectOpt
imisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected:
1] with root cause

StaleObjectStateException : persist failed due to stalestate

I'm stuck here, Couldn't figure out any Solution for StaleObjectStateException.
I have read these StackOverflow Article 1, StackOverflow Article 2, But couldn't get much..
My Code in Abstract Class :
try {
long currentTime = System.currentTimeMillis();
try{
session = sessionFactory.getCurrentSession();
}catch(Exception e){}
if (session == null) {
session = sessionFactory.openSession();
isNewSession = true;
}
if (baseDO.isDeleted()) {
log.debug("Deleting instance" + baseDO.getId());
session.delete(baseDO);
} else if (baseDO.isInserted() || baseDO.isNew()) {
log.debug("Inserting instance");
baseDO.setVersionID(1l);
session.saveOrUpdate(this.getDOName(), baseDO);
} else if (baseDO.isUpdated()) {
log.debug("Updating instance");
//Session session = sessionFactory.getCurrentSession();
baseDO = (B) session.merge(this.getDOName(), baseDO);
session.saveOrUpdate(this.getDOName(), baseDO);
/* I'm getting here exactly on above Line */
// sessionFactory.getCurrentSession().saveOrUpdate(baseDO);
log.debug("Updated instance" + baseDO);
} else {
log.warn("*** Not persisting any Data for " + getDOName() + " ***");
}
log.debug("persist successful");
}
catch(StaleObjectStateException stoe){
log.error("persist failed due to stalestate", stoe);
throw stoe;
}
catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
finally {
if (session != null && isNewSession)
session.close();
}
This is the Error I'm getting :
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) [ERROR] 11:13:52 AbstractDAO - persist failed due to stalestate
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.c2lbiz.symbiosys.insurance.businesscommon.dataobjects.payment.CompensationPayableDO#18238]
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:261)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at com.c2lbiz.symbiosys.systemcommon.dao.hibernate.AbstractDAO.save(AbstractDAO.java:549)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at com.c2lbiz.symbiosys.systemcommon.business.BaseBO.save(BaseBO.java:291)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at com.c2lbiz.symbiosys.interfaces.job.GlPostingWriter.execute(GlPostingWriter.java:63)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at com.c2lbiz.symbiosys.interfaces.job.GlPostingWriter.execute(GlPostingWriter.java:1)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at sun.reflect.GeneratedMethodAccessor598.invoke(Unknown Source)
11:13:52,339 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at java.lang.reflect.Method.invoke(Unknown Source)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at $Proxy62.execute(Unknown Source)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at java.lang.reflect.Method.invoke(Unknown Source)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator.doInvoke(AbstractMethodInvokingDelegator.java:117)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator.invokeDelegateMethodWithArgument(AbstractMethodInvokingDelegator.java:72)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.item.adapter.ItemWriterAdapter.write(ItemWriterAdapter.java:36)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:171)
11:13:52,354 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:150)
11:13:52,370 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:269)
11:13:52,370 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:194)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:74)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:281)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
11:13:52,371 INFO [stdout] (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#62b093c8-1) at java.lang.Thread.run(Unknown Source)
Please Help,
Thanks in Advance.

Categories