Bonjour,
J'ai le code suivant:
L'implémentation:Code:
1
2
3
4
5
6
7
8 @Remote public interface GestionDeStock { // Add business logic below. (Right-click in editor and choose // "Insert Code > Add Business Method") public void ajouter(Product produit); }
J'utilise ensuite dans la partie Web (avec Struts 2) lesCode:
1
2
3
4
5
6
7
8
9
10
11 @Stateless public class GestionDeStockBean implements GestionDeStock{ @PersistenceContext EntityManager em; @Override public void ajouter(Product produit) { em.persist(produit); } }
actions suivantes:
Code:
1
2
3
4
5
6
7
8
9
10
11 public class GestionLookup extends ActionSupport{ public GestionDeStock lookupGestionnaireRemote() { try { Context c = new InitialContext(); return (GestionDeStock) c.lookup("test.GestionDeStock"); } catch (NamingException ne) { throw new RuntimeException(ne); } } }
Mais ça ne marche pas :cry: J'ai l'erreur suivante:Code:
1
2
3
4
5
6
7
8
9
10
11
12
13 public class HelloWorld extends GestionLookup{ @Override public String execute() { setMessage("Hello " + getUserName()); // return "SUCCESS"; GestionDeStock g = lookupGestionnaireRemote(); Product p = new Product(); p.setId(new Long(22)); g.ajouter(p); return "SUCCESS"; } }
java.lang.ClassNotFoundException: test.GestionDeStock
Comment régler ça? une idée? J'utilise Glassfish 3.
Merci!