Could not find any META-INF / No Persistence Provider

Asked

Viewed 51 times

0

I have these errors when trying to compile: my Hibernate 5.4.3.Final I created my folder META-INF

How can I fix this?

INFO: HHH000318: Could not find any META-INF/persistence.xml file in the classpath
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named market
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
    at util.Manager.<init>(Manager.java:19)
    at util.Manager.getInstance(Manager.java:14)
    at dao.PadraoDAO.listarTodos(PadraoDAO.java:11)
    at view.eeee.main(eeee.java:33)

i created the meta inf folder inserir a descrição da imagem aqui

code of my persistence.xml

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd">
    <!-- Define persistence unit -->
    <persistence-unit name="market">
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.hbm2ddl.auto" value="update"/>
        <property name="hibernate.show_sql" value="true"/>
        <property name="hibernate.format_sql" value="true"/>
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/K21_livraria_bd"/>
        <property name="javax.persistence.jdbc.user" value="root"/>
        <property name="javax.persistence.jdbc.password" value=""/>
    </properties>
    </persistence-unit>
</persistence>
  • I could put your code in question or github?

  • @Maurydeveloper I’ll edit right away.

  • Bro I realized something the eclipse won’t let me create in src folder just out of it might be why?

  • I don’t know. Which program do you use?

  • I added @Maurydeveloper I use the eclipse, and whenever I create a Folder in src it automatically creates in the project folder not in src.

  • Must be some eclipse bug.

  • managed to create I was trying to create source Folder ...

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.