bonjour, j'ai un problème sur lequel je suis depuis 1 semaine : j'obtiens une erreur

Échec de la commande deploy : Déploiement de l'application dans le domaine a échoué ; Erreur lors du chargement des descripteurs du déploiement pour le module [poireau_ear] -- Fichier jar EJB [poireau_ejb.jar] non valide : Il ne contient aucun EJB.
au déploiement de l'EJB.

voici ma manière de créer le projet:
- création d'un EAR
je ne coche pas "generate deployment descriptor"
- création d'un EJB plus d'un client; l'EJB est lié à l'EAR précédemment créé
je change le nom du client et du fichier JAR
- j'enlève la référence au client dans le projet EAR/ properties/javaEE module dependencies
- dans les projets suivants je modifie le java build path :
pour l'EAR j'ajoute une référence à l'EJB(ici c'est le javaEE module dependencies qui est modifié, ainsi que projet references)
pour le client: j'ajoute une référence au projet JPA
pour l'EJB, j'ajoute une référence au projet JPA
- dans le projet EJB, je copie un EJB:

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
 
package com.yaps.petstore.stateless.catalog;
 
 
 
import java.util.List;
 
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
 
 
import com.yaps.petstore.entity.catalog.Category;
import com.yaps.petstore.entity.catalog.Item;
import com.yaps.petstore.entity.catalog.Product;
import com.yaps.petstore.exception.ValidationException;
 
@Stateless(name="Catalogsbctg",mappedName="ejb/stateless/catalog")
public class CatalogBean implements CatalogLocal, CatalogRemote {
 
	@PersistenceContext(unitName="petstorePU")
	private EntityManager em;
 
	public Category findCategory(Long categoryId) {
 
		if (categoryId==null)
			throw new ValidationException("categoryId is null");
		Query query=em.createQuery("select c from Category c where id=:id");
		query.setParameter("id",categoryId);
		Category category=null;
		category=(Category)query.getSingleResult();
 
		return category;
 
	}
 
	public Item findItem(Long itemId) {
		if (itemId==null)
			throw new ValidationException("itemId est null");
		Item result=null;
		result=em.find(Item.class, itemId);
 
		return result;
	}
 
	public Product findProduct(Long productId) {
		if (productId==null)
			throw new ValidationException("productId est null");
		Product result=null;
		result=em.find(Product.class, productId);
 
		return result;
	}
 
	@SuppressWarnings("unchecked")
	public List<Item> searchItems(String keyword) {
 
		Query query;
		List<Item> items;
 
		query=em.createQuery("select i from Item i where" +
				"upper (i.name) like :keyword or" +
				"upper (i.product.name) like :keyword" +
				"order by i.product.category.name, i.product.name");
		query.setParameter("keyword", "%"+keyword.toUpperCase()+"%");
		items=query.getResultList();
 
		return items;
 
 
	}
 
	public Category createCategory(Category category) {
		if (category==null)
			throw new ValidationException("category est null");
		em.persist(category);
		return category;
 
	}
 
	public Item createItem(Item item, Product product) {
		if (item==null || product==null)
			throw new ValidationException("item ou product est null");
		item.setProduct(product);
		em.persist(item);
		return item;
	}
 
	public Product createProduct(Product product, Category category) {
		if (product==null || category==null)
			throw new ValidationException("category ou product est null");
		product.setCategory(category);
		em.persist(product);
		return product;
	}
 
	public void deleteCategory(Category category) {
 
		if (category==null)
			throw new ValidationException("category est null");
		em.remove(em.merge(category));
 
	}
 
	public void deleteItem(Item item, Product product) {
		if (item==null || product==null)
			throw new ValidationException("item est null");
		item.setProduct(product);
		em.remove(em.merge(item));
 
	}
 
	public void deleteProduct(Product product) {
		if (product==null)
			throw new ValidationException("product est null");
		em.remove(em.merge(product));
 
	}
 
	@SuppressWarnings("unchecked")
	public List<Category> findCategories() {
 
		Query query=em.createQuery("select c from Category c");
		return query.getResultList();
	}
 
	@SuppressWarnings("unchecked")
	public List<Item> findItems() {
		Query query=em.createQuery("select i from Item i");
		return query.getResultList();
	}
 
	@SuppressWarnings("unchecked")
	public List<Product> findProducts() {
		Query query=em.createQuery("select c from Product c");
		return query.getResultList();
	}
 
	public Category updateCategory(Category category) {
		if (category==null)
			throw new ValidationException("category est null");
		em.merge(category);
 
		return category;
	}
 
	public Item updateItem(Item item, Product product) {
		if (item==null || product==null )
			throw new ValidationException("item ou product est null");
		item.setProduct(product);
		em.merge(item);
 
		return item;
	}
 
	public Product updateProduct(Product product, Category category) {
		if (product==null || category==null )
			throw new ValidationException("category ou product est null");
		product.setCategory(category);
		em.merge(product);
 
		return product;
	}
 
}
-dans le client, je créé une classe qui possède une méthode main, et j'y mets:

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
 
Properties props = new Properties();
        props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
        props.setProperty("java.naming.factory.initial",
                "com.sun.enterprise.naming.SerialInitContextFactory");
        props.setProperty("java.naming.factory.url.pkgs",
                "com.sun.enterprise.naming");
        props.setProperty("java.naming.factory.state",
                "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
 
        props.setProperty("org.omg.CORBA.ORBInitialPort", "10037");
        InitialContext ctx;
        CatalogRemote ctg=null;
		try {
			ctx = new InitialContext(props);
			Object ref = ctx.lookup("ejb/stateless/catalog");
			ctg = (CatalogRemote) PortableRemoteObject.narrow(ref, CatalogRemote.class);
 
			//Object ref = ctx.lookup(CatalogRemote.class.getName());
			//ctg = (CatalogRemote) ref;
 
 
		} catch (NamingException e) {
			// TODO Auto-generated catch block
			System.out.println("message 0");
			e.printStackTrace();
		}
        System.out.println("étape 1 finie");
 
		Category vers=new Category();
		vers.setDescription("birds");
		vers.setName("oiseaux");
		ctg.createCategory(vers);
 
		Category from=null;
		from=ctg.findCategories().get(0);
		System.out.println("oiseaux : "+from.getDescription());

- client: dans le répertoire du code source je copie les interfaces locales et distantes de l'EJB, dans leur paquetage d'origine

- enfin, dans l'EJB, (après un clic droit) je choisis generate deployment descriptor stub (c'est ultra rapide, il ne se passe quasiment rien: est-ce normal?)
- j'ajoute l'EAR au serveur

...et j'obtiens l'erreur mentionnée + haut.

savez-vous où je me suis trompé?

olivier.

PS: le fichier de logs m'indique ceci juste avant la constatation que le fichier d'EJB est vide:

[#|2009-01-15T19:25:15.957+0100|SEVERE|sun-appserver9.1|javax.enterprise.system.tools.deployment|_ThreadID=18;_ThreadName=Thread-37;_RequestID=6320cbef-627f-4910-839e-69f6c32d2452;|Class [ com/yaps/petstore/exception/ValidationException ] not found. Error while loading [ class com.yaps.petstore.stateless.catalog.CatalogBean ]|#]
je ne vois pas ce qui cloche dans mon EJB.