Bonjour,
Je suis en train de faire un projet web sous Eclipse Juno.
J'utilise Hibernate 3, Spring 2.5 et JSF 2 et j'utilise aussi les fichiers de mapping en lieu et place des annotations.
J'ai essayé de faire un test avec Junit 4 mais voici l'erreur que j'ai:Voici mes classes:java.lang.NoClassDefFoundError:org/hamcrest/SelfDescribing
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 package ci.prestige.mediatec.service; import java.util.List; import ci.prestige.mediatec.model.Client; public interface ClientService { List<Client> findAll(); Client findById(Integer IdClient); void save (Client client); }
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 package ci.prestige.mediatec.service; import java.util.*; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import ci.prestige.mediatec.model.Client; @Service("clientService") @Transactional public class ClientServiceImpl implements ClientService { @Autowired private SessionFactory myFactory; @SuppressWarnings("unchecked") @Override public List<Client> findAll() { //return (List<Client>) sessionFactory.getCurrentSession(); return (List<Client>) myFactory.getCurrentSession().createQuery("from Client").list(); } @Override public Client findById(Integer IdClient) { return (Client) myFactory.getCurrentSession().load(Client.class, IdClient); } @Override public void save(Client client) { myFactory.getCurrentSession().saveOrUpdate(client); } }Quelqu'un saurait-il m'indiquer d'où peut venir 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
32
33
34
35
36
37
38
39
40
41
42 package ci.prestige.mediatec.service; import static org.junit.Assert.*; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; public class ClientServiceTest { private static ClassPathXmlApplicationContext context; private static ClientService clientService; @BeforeClass public static void setUpBeforeClass() throws Exception { context = new ClassPathXmlApplicationContext("applicationSpring.xml"); clientService = (ClientService) context.getBean("clientService"); } @AfterClass public static void tearDownAfterClass() throws Exception { context.close(); } @Test public void testFindAll() { fail("Not yet implemented"); } @Test public void testFindById() { fail("Not yet implemented"); } @Test public void testSave() { fail("Not yet implemented"); } }
Merci d'avance pour votre aide.
Partager