问题:
mvn + Arquillian + embedded glassfish
日志中出现:
1 2 |
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-6007] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.QueryException Exception Description: Missing descriptor for [class me.yek.ut2.CrmMessage]. |
persistence.xml
1 2 3 4 5 6 7 8 9 |
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="crm-pu" transaction-type="JTA"> <jta-data-source>java:app/weilei_crm</jta-data-source> <class>me.yek.ut2.CrmMessage</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties/> </persistence-unit> </persistence> |
解决:
persistence.xml 中
不要使用exclude-unlisted-classes
1 2 3 4 5 6 7 8 9 |
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="crm-pu" transaction-type="JTA"> <jta-data-source>java:app/weilei_crm</jta-data-source> <class>me.yek.ut2.CrmMessage</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties/> </persistence-unit> </persistence> |