bonsoir,
j'ai créé un EJB stateless de test, avec une seule méthode : disBonjour, qui retourne la chaîne "bonjour".
avec ceci, une interface distante,
et un client dont voici le code :
j'utilise jboss 5.0.0, eclipse helios.
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 public class Main { public static void main(String[] args) { // TODO Auto-generated method stub try{ Context context = new InitialContext(); /* hello beanRemote = (hello) context.lookup("test_jee_helios/hello/remote");*/ Object o=context.lookup("test_jee_helios/hello/remote"); hello beanRemote=(hello) o; //System.out.println(context.lookup("test_jee_helios/hello/remote").getClass()); System.out.println(beanRemote.sayHello()); } catch (NamingException e) { e.printStackTrace(); } } /* (non-Java-doc) * @see java.lang.Object#Object() */ public Main() { super(); } }
le déploiement se passe bien, je trouve mon EJB dans l'arbre JNDI du site d'administration du serveur.
mais à l'execution j'ai cette erreur:
savez-vous d'où cela vient?Exception in thread "main" java.lang.ClassCastException: $Proxy2 cannot be cast to lorry.hello
at Main.main(Main.java:16)
olivier
ps: j'ai ajouté l'interface serializable à mon EJB, mais apparemment sans changement.
je précise que je suis sous MacOSX snow leopard, si c'est important (paramètres java?).
Partager