Bonjour,
j'espère trouver ma réponse et arriver à expliquer mon problème donc voilà je crée un service web, pour cela je crée deux classes java, la première qui contient une fonction de recherche (Resto), et la seconde celle qui contient le service web appelée (ServicesRestaurant), d'après un tutoriel que j'ai trouvé il faut copier la classe qui contient le service web dans le fichier WEB-INF d'AXIS et la compiler avec l'invite de commande, et c'est ce que je fais mais ca me donne une erreur de compilation comme quoi la classe de recherche (Resto) n'est pas définie voilà mon code pour bien expliquer:
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 package Rest; import java.sql.SQLException; import java.util.LinkedList; public class ServicesRestaurant { public LinkedList<Resto> getResto(String Specialite) throws SQLException, ClassNotFoundException{ Resto t= new Resto(); LinkedList<Resto> l= t.recherche_resto(Specialite); return l; } }je lance la commande
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 package Rest; import java.sql.*; import java.util.LinkedList; public class Resto { public String nom_resto; public String adresse_resto; public String specialite; public Resto(){ this.nom_resto=""; this.adresse_resto=""; this.specialite=""; } public LinkedList<Resto> recherche_resto(String specialite) throws SQLException, ClassNotFoundException{ LinkedList<Resto> l = new LinkedList<Resto>(); Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@localhost:1521:XE"; Connection con = DriverManager.getConnection(url,"System", "Mallorca2010"); Statement statement= con.createStatement(); String query= "SELECT * FROM Restaurant where specialite='"+specialite+"'"; ResultSet resultat = statement.executeQuery(query); while(resultat.next()){ Resto t= new Resto(); t.adresse_resto= resultat.getString(2); t.nom_resto=resultat.getString(1); t.specialite= resultat.getString(3); l.add(t); // Resto t1 = (Resto) l.get(0); // System.out.println(t1.adresse_resto); } return l; } }depuis le WEB-INF d'AXIS et voilà l'erreur:javac ServicesRestaurant.java
Merci d'avance de votre aide
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 ServicesRestaurant.java:9: cannot find symbol symbol : class Resto location: class ServicesRestaurant public LinkedList<Resto> getResto(String Specialite) throws SQLException, ClassNotFoundException{ ^ ServicesRestaurant.java:12: cannot find symbol symbol : class Resto location: class ServicesRestaurant Resto t= new Resto(); ^ ServicesRestaurant.java:12: cannot find symbol symbol : class Resto location: class ServicesRestaurant Resto t= new Resto(); ^ ServicesRestaurant.java:13: cannot find symbol symbol : class Resto location: class ServicesRestaurant LinkedList<Resto> l= t.recherche_resto(Specialite); ^ 4 errors
amicalement
Partager