4

I am getting an error when I try to do a clean/compile/install for one of my modules.

[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:run 
(generate-drop-ddl) on project baseImpl: There was an error creating the AntRun task. 
An Ant BuildException has occured: Problems in creating a configuration for JPA. 
Have you remembered to add hibernate EntityManager jars to the classpath ?: 
InvocationTargetException: Invalid persistence.xml.
[ERROR] Error parsing XML (line-1 :  column -1): cvc-complex-type.2.4.d: 
Invalid content was found starting with element 'class'. 
No child element is expected at this point.

I have another module that compiles/installs fine, and the only difference is that it references different classes, so I can't figure out what's wrong with my persistence.xml, or if that is even the problem.

<?xml version="1.0" encoding="UTF-8"?>
<persistence 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" version="2.0">
<persistence-unit name="appPersistenceUnit">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>base.bo.Address</class>
    <class>base.bo.Club</class>
    <class>base.bo.Team</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>   
</persistence-unit>
</persistence>
4

1 回答 1

0

显然它不是persistence.xml。我从头开始我的 pom 文件,重新进行了清理/编译/安装,它可以工作。去搞清楚。

于 2013-11-13T05:20:33.700 回答