Bonjour,
Je souhaite tester ma classe DAO :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 @ContextConfiguration(locations = {"classpath:META-INF/persistence.xml"}) public class UserControllerTest extends AbstractJUnit4SpringContextTests { @Autowired private UserDao userDao; public UserControllerTest() { } @Test public void addUser() { .......... } }
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 5 in XML document from class path resource [META-INF/persistence.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 75; cvc-elt.1 : Déclaration de l'élément 'persistence' introuvable.
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 <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="persistence" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>entity.Authorities</class> <class>entity.Users</class> <exclude-unlisted-classes>false</exclude-unlisted-classes> <validation-mode>NONE</validation-mode> <properties> ....................... </properties> </persistence-unit> </persistence>
Caused by: org.xml.sax.SAXParseException: cvc-elt.1 : Déclaration de l'élément 'persistence' introuvable.
Pouvez-vous m'aider ?
Partager