Problème Hibernate exécution d'une requête
Bonsoir,
je suis entrain de reprendre le travail d'un ami pour le compte d'un client. Donc je ne fais que des ajouts tout en suivant ses "traces". J'utilise Hibernate, Tomcat 5.5, Struts et Mysql 5.0.
Là personnellement je plante parce qu'après avoir effectué des modifications sur un fichier DAO, tout marche très bien sur le serveur de développement ainsi qu'en local, mais dès qu'il s'agit de faire une mise en ligne (sur le serveur de prod) et que j'essaie de me connecter avec un utilisateur, j'obtiens directement le message suivant :
Citation:
javax.servlet.ServletException: could not execute query
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:516)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:423)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.hibernate.exception.JDBCConnectionException: could not execute query
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:2148)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
org.hibernate.loader.Loader.list(Loader.java:2024)
org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
com.scnf.lot2.dao.UserAccessDAO.initUserSessionPortFeuile3(UserAccessDAO.java:1764)
com.scnf.lot2.dao.UserAccessDAO.initUserContextPortFeuile(UserAccessDAO.java:1119)
com.scnf.lot2.dao.UserAccessDAO.initVipUser(UserAccessDAO.java:188)
com.scnf.lot2.dao.UserAccessDAO.authenticate(UserAccessDAO.java:62)
com.scnf.lot2.action.UserAccessAction.login(UserAccessAction.java:35)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
com.scnf.struts.adapter.BaseAction.execute(BaseAction.java:120)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
J'ai parcouru les forums pour voir d'où ça pouvait provenir. Je me suis dit que ça venait de la base mise en ligne (erreur de mapping?). Alors je l'ai mise en local et sur le dév et ça marche encore très bien. Je pense qu'il s'agit d'une erreur de configuration quelque part. Eclairez-moi s'il vous plaît !! Merci d'avance.
Fichier hibernate.cfg.xml
Je fais joindre aussi le fichier hibernate.cfg.xml , au cas où...
Citation:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-configuration (View Source for full doctype...)>
- <hibernate-configuration>
- <session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/preference?autoReconnect=true</property>
<property name="connection.username">root</property>
<property name="connection.password" />
<property name="c3p0.minPoolSize">3</property>
<property name="c3p0.maxPoolSize">200</property>
<property name="c3p0.maxIdleTime">30</property>
<property name="c3p0.maxStatements">100</property>
<property name="c3p0.acquireIncrement">1</property>
<property name="c3p0.initialPoolSize">3</property>
<property name="c3p0.idleTestPeriod">0</property>
<property name="c3p0.timeout">30</property>
- <!-- ### Apache DBCP Connection Pool ###
-->
- <!-- connection pool
-->
- <!-- <property name="dbcp.maxActive">10</property>
<property name="dbcp.whenExhaustedAction">1</property>
<property name="dbcp.maxWait">20000</property>
<property name="dbcp.maxIdle">10</property>
-->
- <!-- prepared statement cache
-->
- <!-- <property name="dbcp.ps.maxActive">10</property>
<property name="dbcp.ps.whenExhaustedAction">1</property>
<property name="dbcp.ps.maxWait">20000</property>
<property name="dbcp.ps.maxIdle">10</property>
-->
- <!-- optional query to validate pooled connections:
-->
- <!-- <property name="dbcp.validationQuery">select 1</property>
<property name="dbcp.testOnBorrow">true</property>
<property name="dbcp.testOnReturn">true</property>
-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="com/scnf/model/Utilisateur.hbm.xml" />
<mapping resource="com/scnf/model/Profil.hbm.xml" />
<mapping resource="com/scnf/model/Agence.hbm.xml" />
<mapping resource="com/scnf/model/UtilisateurHasProfil.hbm.xml" />
<mapping resource="com/scnf/model/Reseau.hbm.xml" />
<mapping resource="com/scnf/model/Typologie.hbm.xml" />
<mapping resource="com/scnf/model/Region.hbm.xml" />
<mapping resource="com/scnf/model/Mail.hbm.xml" />
<mapping resource="com/scnf/model/MailDestinataire.hbm.xml" />
<mapping resource="com/scnf/model/ContactPerso.hbm.xml" />
<mapping resource="com/scnf/model/Evenement.hbm.xml" />
<mapping resource="com/scnf/model/UtilisateurHasEvenement.hbm.xml" />
<mapping resource="com/scnf/lot2/model/Challenge.hbm.xml" />
<mapping resource="com/scnf/lot2/model/UtilisateurHasMichelineAccessoire.hbm.xml" />
<mapping resource="com/scnf/lot2/model/UtilisateurHasMichelinePersonnalisation.hbm.xml" />
<mapping resource="com/scnf/lot2/model/AgentHasQuizReponse.hbm.xml" />
<mapping resource="com/scnf/lot2/model/CompteAgence.hbm.xml" />
<mapping resource="com/scnf/lot2/model/CompteAgent.hbm.xml" />
<mapping resource="com/scnf/lot2/model/SoldeCcav.hbm.xml" />
<mapping resource="com/scnf/lot2/model/Gain.hbm.xml" />
<mapping resource="com/scnf/lot2/model/AgenceHasDefi.hbm.xml" />
<mapping resource="com/scnf/lot2/model/Defi.hbm.xml" />
<mapping resource="com/scnf/lot2/model/DefiObjectif.hbm.xml" />
<mapping resource="com/scnf/lot2/model/RangDefi.hbm.xml" />
<mapping resource="com/scnf/lot2/model/Quiz.hbm.xml" />
<mapping resource="com/scnf/lot2/model/QuizQuestion.hbm.xml" />
<mapping resource="com/scnf/lot2/model/QuizReponse.hbm.xml" />
<mapping resource="com/scnf/lot2/model/UtilisateurHasQuiz.hbm.xml" />
<mapping resource="com/scnf/lot2/model/TypeGain.hbm.xml" />
<mapping resource="com/scnf/lot2/model/Commande.hbm.xml" />
<mapping resource="com/scnf/lot2/model/CommandeDetail.hbm.xml" />
<mapping resource="com/scnf/lot2/model/AgentHasResultatQuiz.hbm.xml" />
</session-factory>
</hibernate-configuration>
Il s'agit du fichier local bien entendu, pour le serveur de prod je change quelques paramètres (username et password + URL).
voilà.