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

  • SEARCH
  • Home
  • 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 7989505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:46:15+00:00 2026-06-04T12:46:15+00:00

Can’t test a jpa/maven project. I have the error javax.persistence.PersistenceException: No Persistence provider for

  • 0

Can’t test a jpa/maven project. I have the error
“javax.persistence.PersistenceException: No Persistence provider for EntityManager named xxx”
when I run “mvn cleant test” from commandline. I have a Java SE project.

I have the persistence confiuration in ‘src/test/resources/META-INF/persistence.xml’. And I also has the same for ‘src/main/…’.
I can see the persistence.xml in ‘target/classes/META-INF’. Only that is from the main, not from the test as I run the tests. This is not yet the problem, since both should work anyway.
Trying the JPA for the first time, but as I see, the files should be ok (location and content).

The persistence unit names should match also.

I’m using Eclipse (EE) with m2 and other necessary plugins, but running maven from commandline. I see no errors in the project.

// Update

Tried fixing the maven build as I noticed it should have the test classes and resources in ‘target/test-classes’.
Changed the command to “mvn clean test-compile test”
Now the resources can be found from the correct place, but I still got the same error.

// update

For clarity here’s the full persistence.xml

<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="xxx"
    transaction-type="RESOURCE_LOCAL">
    <provider>my.package.EntityManagerFactoryHelper</provider>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/db" />
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
        <property name="javax.persistence.jdbc.user" value="yyy" />
        <property name="javax.persistence.jdbc.password" value="zzz" />
        <property name="eclipselink.ddl-generation" value="DROP_AND_CREATE" />
    </properties>
</persistence-unit>

I took the helper example from other posts. Basically it just creates the emf using the ‘xxx’ persistence unit. Here’s the helper class. http://pastebin.com/1GE6uMa1

  • 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-04T12:46:17+00:00Added an answer on June 4, 2026 at 12:46 pm

    The provider has to be:

         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    

    Else the table creation fails, even that there is no errors when creating the tables from the entities.

    Spent about 2 days resolving this, since I thought I was pointed the right direction by the given hint and didn’t check the provider then.

    The provider has to be according to the eclipselink, as you could spot it in the configuration of the ‘persistence.xml’.

    But I failed to say it explicitly. Didn’t know it would matter that much and it even succeeded with the table creation once. Not really sure what I had for the provider then, but it failed subsequently (after changes made to the table).
    Probably there should had been other configurations by the provider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
Can't figure out how to do this in a pretty way : I have
Can you have submenus with the top level set to checkable in WPF? I
can anyone help me in trying to check whether JavaScript is enabled in client
Can 2 or more equations defining a function in Haskell share the same where
can I make my own headers in HTTP request ? e.g. This is normal
Can this be done? It seems like this should be possible. In general, I
Can anyone tell me whether Helvetica is a browser base font? If so, it
Can anyone recommend a good cheat sheet for gbd? I'm experienced with windbg commands,
Can someone explain it succinctly? Can it be used with non-Silverlight clients?

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.