Announcement Announcement Module
Collapse
No announcement yet.
Unknown threading issue causes async Spring controller method to leak db connections Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unknown threading issue causes async Spring controller method to leak db connections

    Hello,

    I have an asynchronous Spring MVC controller method (which returns a DeferredResult); that controller method calls a Spring service method that itself use the entityManager in order to retrieve data from a database.

    Somehow, the async controller method causes connections to be leaked/abandoned. Here is the full stacktrace:

    Code:
        thread (controller) = http-bio-8080-exec-2
        org.apache.commons.dbcp.AbandonedTrace$AbandonedObjectException: DBCP object created 2013-03-26 15:54:42 by the following code was never closed:
            at org.apache.commons.dbcp.AbandonedTrace.setStackTrace(AbandonedTrace.java:139)
            at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:81)
            at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
            at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
            at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)
            at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
            at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
            at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
            at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
            at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
            at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1395)
            at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59)
            at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:71)
            at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:378)
            at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:335)
            at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:273)
            at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$before$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:63)
            at com.bignibou.service.MessageServiceImpl.findUnreadMessages(MessageServiceImpl.java:36)
            at com.bignibou.controller.MessageController.getMessages(MessageController.java:87)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:601)
            at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
            at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
            at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
            at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
            at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
            at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
            at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
            at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
            at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
            at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
            at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
            at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
            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:243)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
            at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(Charact
    thread (service) = http-bio-8080-exec-2
    I know for certain that the controller and service methods run in the same thread because I have logged it with a Thread.currentThread().getName(); call and in the above case the thread is http-bio-8080-exec-2.

    What I can't pinpoint it the cause of the leak/abandoned connection...

    Note that the service method (i.e. messageService.findUnreadMessages) is @Transactional.

    I know for certain my problem is due to a threading issue. I would be very grateful is someone helped me understand what that threading issue is...

    Regards,

    Julien.

  • #2
    I received the following reply from a core developer of the Spring team:

    If the @Transactional method is invoked and completes before the controller method even returns then there is only one thread involved, so I'm not sure what else is going on. It would be best if you could provide an example of the relevant code and configuration parts (mainly the controller but possibly other details as well, do you have an OpenSessionInViewFilter or interceptor? etc)
    To provide more information, here is the controller method:
    Code:
    @RequestMapping(value = "getMessages", method = RequestMethod.GET, produces = "application/json")
    	@ResponseBody
    	public DeferredResult<List<Message>> getMessages(@RequestParam final Long senderId) {
    		System.err.println("thread (controller) = " + Thread.currentThread().getName());
    		final DeferredResult<List<Message>> deferredResult = new DeferredResult<List<Message>>(15*1000L, Collections.emptyList());
    		messageRequests.put(messageRequestKey, deferredResult);
    
    		deferredResult.onCompletion(new Runnable() {
    			@Override
    			public void run() {
    				messageRequests.remove(messageRequestKey);
    			}
    		});
    		
    		List<Message> unReadMessages = messageService.findUnreadMessages(2L, meId);
    		if (!unReadMessages.isEmpty()) {
    			deferredResult.setResult(unReadMessages);
    		}
    		return deferredResult;
    	}
    One thing I noticed is that the above controller method returns before the onCompletion and onTimeout callbacks are invoked. Could that be part of the problem?

    Otherwise, yes I do use the openEntityManagerInView pattern. My web.xml is as follows:
    Code:
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true">
    	<display-name>bignibou</display-name>
    	<description>Roo generated bignibou application</description>
    	<!-- Enable escaping of form submission contents -->
    	<context-param>
    		<param-name>defaultHtmlEscape</param-name>
    		<param-value>true</param-value>
    	</context-param>
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value>
    	</context-param>
    	<filter>
    		<filter-name>CharacterEncodingFilter</filter-name>
    		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    		<async-supported>true</async-supported>
    		<init-param>
    			<param-name>encoding</param-name>
    			<param-value>UTF-8</param-value>
    		</init-param>
    		<init-param>
    			<param-name>forceEncoding</param-name>
    			<param-value>true</param-value>
    		</init-param>
    	</filter>
    	<filter>
    		<filter-name>HttpMethodFilter</filter-name>
    		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
    		<async-supported>true</async-supported>
    	</filter>
    	<filter>
    		<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    		<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
    		<async-supported>true</async-supported>
    	</filter>
    	<filter-mapping>
    		<filter-name>CharacterEncodingFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	<filter-mapping>
    		<filter-name>HttpMethodFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	<filter-mapping>
    		<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	<!-- Creates the Spring Container shared by all Servlets and Filters -->
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>
    	<listener>
    		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    	</listener>
    	<listener>
        	<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
      	</listener>
    	<!-- Handles Spring requests -->
    	<servlet>
    		<servlet-name>bignibou</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<init-param>
    			<param-name>contextConfigLocation</param-name>
    			<param-value>WEB-INF/spring/webmvc-config.xml</param-value>
    		</init-param>
    		<load-on-startup>1</load-on-startup>
    		<async-supported>true</async-supported>
    	</servlet>
    	<servlet-mapping>
    		<servlet-name>bignibou</servlet-name>
    		<url-pattern>/</url-pattern>
    	</servlet-mapping>
    	<session-config>
    		<session-timeout>15</session-timeout>
    	</session-config>
    	<filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    		<async-supported>true</async-supported>
    	</filter>
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    </web-app>
    Is there any issue with the OEMIV pattern being used with ajax?

    J.

    Comment


    • #3
      This is what I expect *should* happen.

      On the initial request thread, the OEIMV filter acquires an EM instance, then the controller is invoked, which in turn invokes the tx method. The tx method re-uses the same EM instance.

      Then the controller method returns and the Servlet container thread is exited, but OEIMV filter doesn't release the EM instance because it is aware of the async processing.

      When the DeferredResult is set, a dispatch is made back to the container, hitting the OEIMV filter and the DispatcherServlet once again. When that thread completes, OEIMV filter will release the EM instance. Note that this is true even if the DeferredResult is set in the controller method.

      All the code samples look good to me. What I don't see yet still is how the DeferredResult may be set when the controller doesn't find any unread messages. That happens from some other thread, and since the thread is not known to Spring MVC, it will not have access to the same EM instance.

      Comment


      • #4
        Hi Rossen,

        Thanks for your reply.

        I have managed to reproduce the issue and have included the sample application hereby. It is just the spring mvc chat application together with one JPA entity. One just needs an empty MySQL schema called "bignibou" on localhost. Hibernate will do the rest. After logging in and posting a message, the app just hangs...

        Here is a relevant part of the thread dump:

        Code:
        "http-bio-8080-exec-5" daemon prio=10 tid=0x00007f178c012000 nid=0x1111 in Object.wait() [0x00007f17e4ebf000]
           java.lang.Thread.State: WAITING (on object monitor)
        	at java.lang.Object.wait(Native Method)
        	- waiting on <0x00000007e5162fa8> (a org.apache.commons.pool.impl.GenericObjectPool$Latch)
        	at java.lang.Object.wait(Object.java:503)
        	at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1115)
        	- locked <0x00000007e5162fa8> (a org.apache.commons.pool.impl.GenericObjectPool$Latch)
        	at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
        	at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
        	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        	at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)
        	at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
        	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
        	at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
        	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
        	at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
        	at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1395)
        	at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59)
        	at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:71)
        	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:378)
        	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
        	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:329)
        	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:105)
        	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
        	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        	at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91)
        	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
        	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
        	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        	at com.sun.proxy.$Proxy36.findAll(Unknown Source)
        	at org.springframework.samples.async.chat.MyServiceImpl.someTransactionalMethod(MyServiceImpl.java:18)
        	at org.springframework.samples.async.chat.ChatController.getMessages(ChatController.java:47)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:601)
        	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
        	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
        	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
        	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
        	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
        	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
        	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
        	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
        	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:920)
        	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:816)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:801)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
        	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        	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:243)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
        	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
        	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
        	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
        	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
        	- locked <0x00000007e15d31e8> (a org.apache.tomcat.util.net.SocketWrapper)
        	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        	at java.lang.Thread.run(Thread.java:722)
        
           Locked ownable synchronizers:
        	- <0x00000007e15d2990> (a java.util.concurrent.ThreadPoolExecutor$Worker)

        That happens from some other thread, and since the thread is not known to Spring MVC, it will not have access to the same EM instance.
        Ummm. Do you mean to say that would be the cause of the problem?

        Regards,

        J.
        Last edited by balteo; Mar 28th, 2013, 03:44 PM.

        Comment


        • #5
          hi it's been a while but the ticket is now updated. For reference to anyone else Filter's need to be configured explicitly in web.xml whether they should be invoked on an async dispatch or not. For the OpenEntityInViewFilter this is critical. See the JIRA ticket for details.

          Comment

          Working...
          X