Bonjour
Je dois faire un EJB du côté de l'ancien Jboss pour récupérer des données depuis le 7.1, mais voilà, ça fait plusieurs jours que je stagne sur ce problème...
Jboss 4.2: Interface
Jboss 4.2: Bean
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 import java.util.List; import java.util.Set; import javax.ejb.Remote; @Remote //@EJB(name="Ejb", beanInterface=Bean.class) public interface Ejb { // Pour les tests public List<String> getListe(); }
Jboss 7.1: Client
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 import java.util.List; import javax.ejb.Stateless; //@Stateless //@Remote(Ejb.class) @Stateless (name="Ejb") public class Bean implements Ejb { @Override public List<String> getListeServices() { return Constantes.getListe(); } }
Résultat dans les logs 7.1
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 import java.util.Hashtable; import java.util.List; import javax.naming.InitialContext; import javax.naming.NamingException; public class Client { private static InitialContext context; public static final String RemoteJNDIName = "ejb:Ejb/Ejb//Bean!com.monpackage.ejb.Ejb"; public Client() { if (context == null) { try { final Hashtable<String, Object> jndiProperties = new Hashtable<String, Object>(); jndiProperties.put( javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jboss.as.naming.InitialContextFactory" ); jndiProperties.put( javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" ); jndiProperties.put( javax.naming.Context.PROVIDER_URL, "ejb://192.168.0.156:1099/Bean!com.monpackage.ejb.Bean" ); jndiProperties.put("jboss.naming.client.ejb.context", true); context = new InitialContext(jndiProperties); } catch (Exception e) { e.printStackTrace(); } } Ejb ejb = null; try { ejb = ((Ejb)context.lookup(RemoteJNDIName)); } catch (NamingException e) { e.printStackTrace(); } if(ejb != null){ List<String> liste = ejb.getListe(); } } }
Toute aide est la bienvenue, j'ai suivi une centaine de tutos et toujours rien, ou pire certaines fois...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 (http--0.0.0.0-180-1) : java.lang.IllegalStateException: No EJB receiver available for handling [appName:Ejb,modulename:Ejb,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@5d7ccd ...
Merci d'avance
Partager