Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8664819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:19:58+00:00 2026-06-12T17:19:58+00:00

I am having a No Persistence provider for EntityManager exception, and can’t figure out

  • 0

I am having a No Persistence provider for EntityManager exception, and can’t figure out what is causing it. Here is my configuration file:

Persistence.xml (stored in src/META-INF)

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    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">
    <persistence-unit name="HatifimJPA" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <class>entities.HatUser</class>
        <properties>
            <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
            <property name="hibernate.connection.username" value="Benny" />
            <property name="hibernate.connection.password" value="oracle" />
            <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
        </properties>
    </persistence-unit>
</persistence>

Exception:

Exception in thread “main” javax.persistence.PersistenceException: No Persistence provider for EntityManager named HatifimJPA
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)
at testing.TestClass.main(TestClass.java:16)

The only difference is that I am trying to get the EntityManager into a public void main(...) { ... } block, however, I don’t recall having a problem doing that in the past.

Can anyone help to point out where my problem might reside?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:19:59+00:00Added an answer on June 12, 2026 at 5:19 pm

    Try putting the persistence.xml to src/main/resources/META-INF/
    and put this code to the main method:

    EntityManagerFactory emf = Persistence.createEntityManagerFactory("HatifimJPA");
    EntityManager em = emf.createEntityManager();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a javax.persistence.Query object how can I manipulate it, or how can I inject
I'm having trouble figuring out how to set up JPA persistence (using EclipseLink and
Having a hard time with labels on a ggplot2 plot. Here's a similar plot
Having trouble with an .htaccess file on WAMP. Works on the live server, but
I'm ( still ) having loads of issues with HSQLdb & OpenJPA. Exception in
I am having an issue with creating queries with javax.persistence.criteria.CriteriaBuilder. I am using EclipseLink
I am attempting to create a EJB3.0 container-managed persistence bean and am having issues
i am using persistence.js in a project and i am having some issues with
A service tier that implements its persistence based on JPA can profit hugely from
Consider having an application using DataNucleus with the following persistence structure: You have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.