Doncho Balamjiev Doncho Balamjiev - 13 days ago 8
Java Question

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

PersistenceException: No Persistence provider for EntityManager

On the imane is my persistance.xml file pat but it's not working. I try to change file path to web/WEB-INF/classes/META-INF, but its's still not working.

Here my full persistance.xml source

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

<persistence xmlns="" version="2.1">

<persistence-unit name="StudentPU">
<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="" value="update"/>
<property name="hibernate.temp.use_jdbc_metadata_defaults"
value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />

And one more thing? Why HibernatePersistence is stricken?
I resolve "stricken" mistake like that - image
Is it correct?
But anyway the PersistenceException: No Persistence provider for EntityManager still there.

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.

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

This is working path when We create Web Applications with IntelliJ.