Bonjour ,
Lorsque j'essaie de compiler mon listener il m'apparait l'erreur suivante mais je ne comprend pas pourquoi il ne c
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
C:\Users\anthony\Desktop\Projet>javac MonListener.java
MonListener.java:3: package orh.apache.commons.dbcp does not exist
import javax.sql.*;import orh.apache.commons.dbcp.BasicDataSource;
                                                 ^
MonListener.java:4: MonListener is not abstract and does not override abstract method contextDestroyed(ServletContextEvent) in ServletContextListener
public class MonListener implements ServletContextListener {
       ^
MonListener.java:7: cannot find symbol
dataSource dataSource=new BasicDataSource();
^
  symbol:   class dataSource
  location: class MonListener
MonListener.java:7: cannot find symbol
dataSource dataSource=new BasicDataSource();
                          ^
  symbol:   class BasicDataSource
  location: class MonListener
MonListener.java:8: cannot find symbol
String pilote=application.getInitParameter("pilote");
                         ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
MonListener.java:10: cannot find symbol
dataSource.setURL(application.getInitParameter("base"));
                             ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
MonListener.java:12: cannot find symbol
dataSource.setUserName(application.getInitParameter("login"));
                                  ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
MonListener.java:13: cannot find symbol
dataSource.setPassword(application.getInitParameter("motDePasse"));
                                  ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
8 errors
 
C:\Users\anthony\Desktop\Projet>javac MonListener.java
MonListener.java:3: package org.apache.commons.dbcp does not exist
import javax.sql.*;import org.apache.commons.dbcp.BasicDataSource;
                                                 ^
MonListener.java:4: MonListener is not abstract and does not override abstract method contextDestroyed(ServletContextEvent) in ServletContextListener
public class MonListener implements ServletContextListener {
       ^
MonListener.java:7: cannot find symbol
dataSource dataSource=new BasicDataSource();
^
  symbol:   class dataSource
  location: class MonListener
MonListener.java:7: cannot find symbol
dataSource dataSource=new BasicDataSource();
                          ^
  symbol:   class BasicDataSource
  location: class MonListener
MonListener.java:8: cannot find symbol
String pilote=application.getInitParameter("pilote");
                         ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
MonListener.java:10: cannot find symbol
dataSource.setURL(application.getInitParameter("base"));
                             ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
MonListener.java:12: cannot find symbol
dataSource.setUserName(application.getInitParameter("login"));
                                  ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
MonListener.java:13: cannot find symbol
dataSource.setPassword(application.getInitParameter("motDePasse"));
                                  ^
  symbol:   method getInitParameter(String)
  location: interface ServletContext
8 errors
Bon pour l'erreur d'import je dois juste mettre le fichier "tomcat-dbcp.jar" dans mon classpath non ?Mais pour le reste je ne comprend vraiment pas ..:/
Merci d'avance pour vos réponse