Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试执行maven clean安装时persistence.xml文件出现问题_Java_Hibernate_Maven_Jpa - Fatal编程技术网

Java 尝试执行maven clean安装时persistence.xml文件出现问题

Java 尝试执行maven clean安装时persistence.xml文件出现问题,java,hibernate,maven,jpa,Java,Hibernate,Maven,Jpa,当我尝试为我的一个模块执行清理/编译/安装时,我遇到了一个错误 [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 cr

当我尝试为我的一个模块执行清理/编译/安装时,我遇到了一个错误

[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.
我有另一个模块可以很好地编译/安装,唯一的区别是它引用了不同的类,所以我无法找出persistence.xml有什么问题,或者这是否就是问题所在

<?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>

org.hibernate.ejb.HibernatePersistence
base.bo.Address
基地俱乐部
基地队
真的

显然,它不是persistence.xml。我从头开始我的pom文件,重新编辑了clean/compile/install,它可以正常工作。仔细想想。

没有结束标记,是打字错误吗?是的,它在那里,只是没有被张贴。在持久化单元标记中使用transaction type=“RESOURCE\u LOCAL”。你张贴了所有的persistence.xml文件还是剪切了
列表?这似乎是一个xml解析问题。对了,我只是复制了另一个模块的整个模块,并为这个模块添加了类。