简体   繁体   English

我找不到解析PersistenceException:EntityManager没有持久性提供程序

[英]I can't find resolve PersistenceException: No Persistence provider for EntityManager

I found some solutions in the forum, but they not working for me. 我在论坛中找到了一些解决方案,但它们对我不起作用。 The problem is that when I run main method I receive this exception - 问题是当我运行main方法时,我收到此异常- 图片

PersistenceException: No Persistence provider for EntityManager PersistenceException:没有EntityManager的持久性提供程序

On the imane is my persistance.xml file pat but it's not working. 在imane上是我的persistance.xml文件pat,但是它不起作用。 I try to change file path to web/WEB-INF/classes/META-INF, but its's still not working. 我尝试将文件路径更改为web / WEB-INF / classes / META-INF,但仍无法正常工作。

Here my full persistance.xml source 这是我完整的persistance.xml来源

<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1">

    <persistence-unit name="StudentPU">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <class>com.classes.StudentBean</class>
        <properties>
            <property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/~/Students"/>
            <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>
            <property name="hibernate.connection.username" value="doncho"/>
            <property name="hibernate.connection.password" value=""/>
            <property name="hibernate.archive.autodetection" value="class"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hbm2ddl.auto" value="update"/>
            <property name="hibernate.temp.use_jdbc_metadata_defaults"
                      value="false" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
        </properties>
    </persistence-unit>
</persistence>

And one more thing? 还有一件事? Why HibernatePersistence is stricken? 为什么HibernatePersistence受到打击? I resolve "stricken" mistake like that - 我这样解决“严重”错误- 图片 Is it correct? 这是正确的吗? But anyway the PersistenceException: No Persistence provider for EntityManager still there. 但是无论如何,PersistenceException:仍然没有EntityManager的持久性提供程序。

I tryed - this and this - nothings happened 我尝试- 这个这个 -什么都没发生

I would be grateful for any ideas to resolve this error because @Entity method is important to me. 我将不胜感激任何想法来解决此错误,因为@Entity方法对我很重要。

Best regards, 最好的祝福,

D. Balamjiev 巴拉姆吉耶夫

The workig method for me is to create this path in my project tree: web/WEB-INF/classes/META-INF/persistence.xml 对我来说,workig方法是在我的项目树中创建以下路径: web / WEB-INF / classes / META-INF / persistence.xml

This is working path when We create Web Applications with IntelliJ. 当我们使用IntelliJ创建Web应用程序时,这是工作路径。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PersistenceException:没有名为EntityManager的持久性提供程序 - PersistenceException: No Persistence provider for EntityManager named tomcat 中的 PersistenceException(EntityManager 没有持久性提供程序) - PersistenceException( No persistence provider for EntityManager) in tomcat jakarta.persistence.PersistenceException:EntityManager 没有持久性提供程序 - jakarta.persistence.PersistenceException: No Persistence provider for EntityManager javax.persistence.PersistenceException:EntityManager 没有持久性提供程序 - javax.persistence.PersistenceException: No Persistence provider for EntityManager 有时会遇到PersistenceException:EntityManager没有持久性提供程序 - Sometimes getting PersistenceException: No Persistence provider for EntityManager 仍在获取PersistenceException:EntityManager没有持久性提供程序 - Still getting PersistenceException: No Persistence provider for EntityManager javax.persistence.PersistenceException:名为aramis的EntityManager的持久性提供程序 - javax.persistence.PersistenceException: No Persistence provider for EntityManager named aramis 具有Java SE的JPA:javax.persistence.PersistenceException:EntityManager没有持久性提供程序 - JPA with Java SE: javax.persistence.PersistenceException: No Persistence provider for EntityManager javax.persistence.PersistenceException:没有名为EntityManager的持久性提供程序 - javax.persistence.PersistenceException: No Persistence provider for EntityManager named javax.persistence.PersistenceException:没有名为EntityManager的持久性提供程序 - javax.persistence.PersistenceException: No Persistence provider for EntityManager named
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM