Java – Maven / Eclipse: no meta-inf / persistence.inf found in the classpath XML file

I know other problems about this problem, but no solution is useful to me I am using Maven to build a java project in eclipse, my persistence XML file in Src / main / resource / meta_ Inf folder But when I try to install MVN, I always get this error:

No Persistence provider for EntityManager named plasma.persistence

Look at the console output, which seems to be caused by this:

[org.hibernate.jpa.boot.internal.PersistenceXmlParser] - HHH000318: Could not find any Meta-INF/persistence.xml file in the classpath

This is my persistence XML file:

<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="plasma.persistence" transaction-type="RESOURCE_LOCAL">
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
        <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
        <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432:xxxxx"/>
        <property name="hibernate.connection.username" value="xxxxx"/>
        <property name="hibernate.connection.password" value="xxxxx"/>
        <property name="hibernate.connection.pool_size" value="5"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.format_sql" value="true"/>
        <property name="hibernate.max_fetch_depth" value="5"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
</persistence-unit>

I've tried right clicking on the project and meta_ The inf folder was added to the build path and still does not work Any ideas?

Solution

The correct home of the persistence file should be Src / main / resources / meta inf. in this problem, you mentioned Src / main / resources / meta_ Inf. note that resources and dashes (–) in meta-inf should have an's' instead of an underscore Those are just wrong questions? If not, fix the path and it should work

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>