Problème connexion struts mysql
Bonjour,
Je termine le tuto de Serge Tahé et j'en suis à la connexion db; J'ai MySQL en localhost sur le 3306, mais lorsque je lance le projet j'ai ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| java.lang.NoSuchMethodError: be.aptelia.articles.ListeArticlesAction.getDataSource(Ljavax/servlet/http/HttpServletRequest;Ljava/lang/String;)Ljavax/sql/DataSource;
at be.aptelia.articles.ListeArticlesAction.execute(ListeArticlesAction.java:35)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595) |
Le Struts-config.xml est le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<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/test" />
<set-property property="username" value="root" />
<set-property property="password" value="rem42axa" />
<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-sources>
<action-mappings>
<action
path="/liste"
type="be.aptelia.articles.ListeArticlesAction">
<forward name="afficherListeArticles" path="/vues/jsp/listarticles.jsp" />
<forward name="afficherErreurs" path="/vues/jsp/erreurs.jsp" />
</action>
</action-mappings>
<message-resources
parameter="ressources.ApplicationRessources.properties"
null="false" />
</struts-config> |
et l'erreur provient de la connection ligne en rouge :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
// lit le contenu de la table articles d'une connexion
// réalisée à l'init du contexte
// on récupère a source de données dbarticles
DataSource dataSource = this.getDataSource(request,"dbarticles");
if (dataSource == null) {
// la source de données n'a pas pu être créée
ActionErrors erreurs = new ActionErrors();
erreurs.add("dbarticles", new ActionMessage("erreur.dbarticles", "La source de données n'a pu être créée"));
this.addErrors(request, erreurs);
return mapping.findForward("afficherErreurs");
} |
Quelqu'un pourait-il me dire ce que j'ai fait comme grosse c........ :?
Merci pour votre aide