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 8149951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:57:11+00:00 2026-06-06T14:57:11+00:00

I have a jar with JPA entities in it from another application with the

  • 0

I have a jar with JPA entities in it from another application with the persistence.xml file. Is there a way to tweak play so

  1. It fills in the persistence.xml with property values
  2. It sets up the in-memory database still and allows us to save/query, etc.

Currently, I get an error “A JPA error occurred (The JPA context is not initialized. JPA Entity Manager automatically start when one or more classes annotated with the @javax.persistence.Entity annotation are found in the application.)”

ps. I have my entity jar in the lib directory of course with the persistence.xml file there AND it works until I pull all my entities out of my model(if no entities in model, it doesn’t seem to work).

thanks,
Dean

  • 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-06T14:57:13+00:00Added an answer on June 6, 2026 at 2:57 pm

    I’m presently in a similar situation, but using Play 2.0.1, so I’m not sure I could answer your two questions, but I do believe that I could potentially help with the error you receive.

    My persistence.xml file set-up for Hibernate and the in-memory database:

        <persistence-unit name="testUnit">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jar-file>path/to/jar-file.jar/jar-file>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.connection.url" value="jdbc:h2:mem:events"/>
        </properties>
    </persistence-unit>
    

    What I imagine is you do not include your jar-file, so although you have the jar in your build path, it is not recognized by your JPA Entity Manager.

    Also, you should check to make sure you do not need to place your persistence.xml file in your /conf/META-INF folder, though this may be Play 2.0.1 specific, but it was something else that I encountered working on mine.

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

Sidebar

Related Questions

I have a standalone java application, which uses JPA for its persistence. Right now
I have a jar file named umar.jar in /root/umar/bin directory. I have a shell
I have a jar file that I would like to execute using PHP, but
I have a jar file with resources (mainly configuration for caches, logging, etc) that
I have a jar file and I invoke the jar using java -jar myjar.jar
i have added google admob jar, have added jar file to builtpath and also
I have few jar files which I am not getting from any repositories.I have
That is when you have any jar file attached to you your class path.
I have a java JAR file that is triggered by a SQL server job.
I have developed an Java application with RMI,JPA and H2DB, look at the screenshot

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.