Sous JBoss4.2.2GA , je cherche à appeler un ejb2 à partir d'un ejb3
D'apres les docs, il "suffirait" d'écrire dans mon ejb3
Mais j'obtiens l'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 @EJB(mappedName="ejb/xx/AdminLocal", beanInterface=AdminLocal.class ) AdminLocal adminLocal; ... List<AdministrateurData> list = adminLocal.getListeAdministrateurs();
Non matching type for inject of field: com.xx.interfaces.AdminLocal com.xx.ejb.Eproc3Bean.adminLocal for type: $Proxy90 of jndiName env/com.xx.ejb.Eproc3Bean/adminLocal
intfs: , com.xx.interfaces.AdminLocalHome
Dans mon ejb3, Le seul truc qui marche pour moi est
Quelques précisions :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 @Resource SessionContext sc; .... AdminLocalHome adminLocalHome = (AdminLocalHome) sc.lookup("ejb/xx/AdminLocal"); AdminLocal adminLocal = adminLocalHome.create(); List<AdministrateurData> list = adminLocal.getListeAdministrateurs();
- Mon ejb3 est seul dans un jar (sans fichier META-INF/ejb-jar.xml)
- Mon ejb2 est dans un autre jar (avec les fichiers META-INF/ejb-jar.xml et META-INF/jboss.xml ci-dessous)
META-INF/ejb-jar.xml :
META-INF/jboss.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <session > <description><![CDATA[]]></description> <ejb-name>Admin</ejb-name> <home>com.xx.interfaces.AdminHome</home> <remote>com.xx.interfaces.Admin</remote> <local-home>com.xx.interfaces.AdminLocalHome</local-home> <local>com.xx.interfaces.AdminLocal</local> <ejb-class>com.xx.ejb.AdminBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session>
Bien sur, je préférerai injecter mon ejb2 avec la notation @EJB(...) plus cool à utiliser...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <session> <ejb-name>Admin</ejb-name> <jndi-name>ejb/xx/Admin</jndi-name> <local-jndi-name>ejb/xx/AdminLocal</local-jndi-name> <method-attributes> </method-attributes> </session>
So I need help please...
Partager