Bonjour,
J'ai un ejb PersonDAO qui étends une PersonDAS qui est chargé dans Jboss.
Je fait une petit client, au mot près, comme dans les exemples, mais ça plante :
J'ai joué avec les DAO / DAS mais quoi que je fasse j'ai cette erreur :
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 public static void main(String[] args) { InitialContext ini = null; Hashtable<String, String> ht = new Hashtable<String, String>(); ht.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); ht.put("java.naming.provider.url", "localhost"); ht.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); try { ini = new InitialContext(ht); } catch (NamingException e) { System.err.println("init"); e.printStackTrace(); } PersonDAS pdao = null; try { pdao = (PersonDAO) ini.lookup("PersonDAO/remote"); System.out.println(pdao.getClass()); } catch (NamingException e) { System.err.println("lookup"); e.printStackTrace(); } }
Par contre, si je récupère le ini.lookup() dans un Object, ça ne plante pas, et si je fait un toString() de cet object il m'affiche tout ce qu'il faut :java.lang.ClassCastException: javax.naming.Reference cannot be cast to test.dao.PersonDAO
Donc je sais qu'on doit normalement passer par des couches de service etc, mais ce n'est pas la question puisque si on ne peut pas accéder à cet ejb, je ne vois pas comment on pourrait accéder aux autres.Reference Class Name: Proxy for: test.das.PersonDAS
Type: ProxyFactoryKey
Content: ProxyFactory/PersonDAO/PersonDAO/remote
Type: EJB Container Name
Content: jboss.j2ee:jar=test.jar,name=PersonDAO,service=EJB3
Type: Proxy Factory is Local
Content: false
Type: Remote Business Interface
Content: test.das.PersonDAS
Type: Remoting Host URL
Content: socket://127.0.0.1:3873/
Si vous pouviez éclairer ma lanterne,
Merci d'avance.
Partager