Bonjour,
Désole par avance si je suis trop long.
Voici mon problème.
J'ai déployé une application web (Java 8 / Tomcat 8 / MySQL 5 / Debian 8) il y a plusieurs années utilisant la technologie Hibernate et qui n'est malheureusement plus maintenu.
Depuis plusieurs semaines, au bout de quelques heures ou de quelques jours suivant les semaines, l'application plante et devient inutilisable.
Les logs montrent la remontée d'erreur suivante :
Exception levée
Nom IllegalStateException
Message No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
Pile d'exécution java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
Pile d'exécution détaillée java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:349)
org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:199)
org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:422)
org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:361)
org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:974)
org.springframework.orm.hibernate3.HibernateTemplate.findByCriteria(HibernateTemplate.java:967)
org.esupportail.helpdesk.dao.HibernateDaoServiceImpl.getVersionManager(HibernateDaoServiceImpl.java:3142)
org.esupportail.helpdesk.dao.HibernateDaoServiceImpl$$FastClassByCGLIB$$a0153163.invoke(<generated>)
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
org.esupportail.helpdesk.dao.HibernateDaoServiceImpl$$EnhancerByCGLIB$$9524b5c3.getVersionManager(<generated>)
org.esupportail.helpdesk.domain.DomainServiceImpl.getDatabaseVersion(DomainServiceImpl.java:3933)
org.esupportail.helpdesk.domain.DomainServiceImpl$$FastClassByCGLIB$$21f7d1d.invoke(<generated>)
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
org.esupportail.helpdesk.domain.DomainServiceImpl$$EnhancerByCGLIB$$682fcd41.getDatabaseVersion(<generated>)
org.esupportail.helpdesk.services.application.VersionningServiceImpl.checkVersion(VersionningServiceImpl.java:353)
org.esupportail.commons.services.application.VersionningUtils.checkVersion(VersionningUtils.java:99)
org.esupportail.commons.web.servlet.FacesServlet.checkVersion(FacesServlet.java:213)
org.esupportail.commons.web.servlet.FacesServlet.service(FacesServlet.java:356)
javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1580)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1537)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745) Sachant que je ne peux pas modifier le code Java, j'essaie de modifier tant bien que mal mon pool de connexion ou les fichiers XML DAO afin de remédier à ce problème mais malheureusement sans succès.
Voici mon pool déclaré dans le server.xml de mon Tomcat :
Code:
<Resource name="jdbc/esup-helpdesk"
type="javax.sql.DataSource"
username="*********"
password="**************"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://**********/********?autoReconnect=true"
maxActive="100"
maxIdle="10"
maxWait="10000"
poolPreparedStatements="true"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
validationQuery="select '1'"
validationInterval="30000"
timeBetweenEvictionRunsMillis="30000"
abandonWhenPercentageFull="50"
jdbcInterceptors="ResetAbandonedTimer"/>
Ainsi que le fichier DAO hibernate :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<!--
/properties/dao/hibernate/hibernate.cfg.xml
The main Hibernate configuration file.
It is referenced from /properties/dao/dao.xml
and the database mapping is in folder
/properties/dao/hibernate/mapping.
-->
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name="hibernate.connection.datasource">java:/comp/env/jdbc/esup-helpdesk</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>
<property name="connection.autoReconnect">true</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="hibernate.jdbc.fetch_size">25</property>
<property name="hibernate.jdbc.batch_size">25</property>
<property name="hibernate.jdbc.use_scrollable_resultset">true</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.max_fetch_depth">1</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_second_level_cache">false</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="exposeTransactionAwareSessionFactory">false</property>
<property name="dbcp.validationQuery">select 1</property>
<property name="dbcp.testOnReturn">true</property>
<property name="dbcp.testWhileIdle">true</property>
<property name="dbcp.timeBetweenEvictionRunsMillis">10000</property>
<property name="dbcp.numTestsPerEvictionRun">10</property>
</session-factory>
</hibernate-configuration>
N'étant pas du tout à l'aise avec Hibernate, avez vous des paramètres à me conseiller/modifier (cf.
https://docs.jboss.org/hibernate/orm/3. ... ation.html) dont je pourrai ajouter dans mon fichier DAO afin de remédier à l'erreur :
"java.lang.IllegalStateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"Merci par avance.
Cordialement.
PS : les jar hibernate utilisés sont les versions suivantes hibernate-3.3.1.ga.jar et spring-hibernate3-2.0.8.jar