2015年11月20日 | Leave a comment 问题: mvn + Arquillian + embedded glassfish 日志中出现: 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]. 12 Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-6007] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.QueryExceptionException Description: Missing descriptor for [class me.yek.ut2.CrmMessage]. persistence.xml <?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> 123456789 <?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 <?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> 123456789 <?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>