Je n'arrive pas à me connecter à ma base mysql depuis struts :
Fichier struts-config.xml:
<data-sources>
<!-- configuration for commons BasicDataSource -->
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="dbarticles">
<set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
<set-property property="url" value="jdbc:mysql://localhost:3306/dbarticles" />
<set-property property="username" value="root" />
<set-property property="password" value="pepere" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
</data-source>
<data-source type="org.apache.commons.dbcp.BasicDataSource" key="pgdbarticles" >
<set-property property="driverClassName" value="org.postgresql.Driver" />
<set-property property="url" value="jdbc:postgresql://localhost/dbarticles" />
<set-property property="username" value="root" />
<set-property property="password" value="pepere" />
<set-property property="maxActive" value="10" />
<set-property property="maxWait" value="5000" />
<set-property property="defaultAutoCommit" value="false" />
<set-property property="defaultReadOnly" value="false" />
</data-source>
<message-resources parameter="istia.st.struts.articles.ApplicationResources" null="false" />
</struts-config>
J'ai le dernier mysql-connector (dans le common/lib du serveur tomcat) et tomcat 5.5.4.
J'ai le jdk 1.5.
Je suis sous debian/Linux.
Je vous joins l'erreur qui est signalée:
GRAVE: La servlet /strutslistarticles a généré une exception "load()"
javax.servlet.UnavailableException: org/apache/commons/pool/impl/GenericObjectPool
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:368)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1053)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:886)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3817)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4079)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2914)
at org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:907)
at org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:454)
at org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
En fait la classe devrait s'initialiser au démarrage, et créer le pool de connection.
Mais la connection à MySQL plante, et je n'arrive pas à diagnosticer le
problème, car j'ai tout essayer, enfin je crois.