Skip to content

Hibernate session cannot be found after upgrading Tomcat from 7.0.50 to 8.0.3 [SPR-11447] #16073

Closed
@spring-projects-issues

Description

@spring-projects-issues

Holger Stenzhorn opened SPR-11447 and commented

My web application uses a combination of Spring with Hibernate (currently at 4.2.8). In the application context, I define the following:

<context:load-time-weaver/>
<context:spring-configured/>
<context:annotation-config/>
<context:component-scan base-package="org.obtima"
                        scoped-proxy="targetClass"/>
<tx:annotation-driven mode="aspectj"/>

This is working as expected until Tomcat 7.0.50. But when I deploy on 8.0.3 the first attempt to access the database, i.e. when I am trying to login to the application, fails:

19-Feb-2014 16:27:24.083 SEVERE [http-nio-8084-exec-12] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [default] in context with path [/test] threw exception
 org.hibernate.HibernateException: No Session found for current thread
	at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)
	at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:992)

After removing mode="aspectj" from <tx:annotation-driven/> the above mentioned login works and so the session was obviously found then (but code marked with @Transactional fails now).


Affects: 3.2.8

Issue Links:

2 votes, 2 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions