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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:24:30+00:00 2026-05-27T22:24:30+00:00

This is driving me crazy and I’m shocked that official documentation is absolutely useles.

  • 0

This is driving me crazy and I’m shocked that official documentation is absolutely useles.

Here is what I have:

  • IntelliJ IDEA 11
  • OpenJPA 2.1.1

Since openjpa is added into list of used libraries I already had classpath to OpenJPA which looks like this

<path id="library.openjpa.classpath">
    <fileset dir="${basedir}/lib/openjpa">
        <patternset refid="library.patterns"/>
    </fileset>
</path>

According to official documentation I added following target

<target name="enhance">
    <copy includeemptydirs="false" todir="${basedir}/lib/openjpa">
        <fileset dir="src" excludes="**/*.launch, **/*.java"/>
    </copy>

    <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
        <classpath refid="library.openjpa.classpath"/>
    </taskdef>

    <openjpac>
        <classpath refid="library.openjpa.classpath"/>
    </openjpac>
</target>

It gives me exception

C:\work\prj\build.xml:283: org.apache.openjpa.util.MetaDataException:
MetaDataFactory could not be configured
(conf.newMetaDataFactoryInstance() returned null). This might mean
that no configuration properties were found. Ensure that you have a
META-INF/persistence.xml file, that it is available in your classpath,
or that the properties file you are using for configuration is
available. If you are using Ant, please see the or
attributes of the task’s nested element.
This can also occur if your OpenJPA distribution jars are corrupt, or
if your security policy is overly strict.

I tested with Process Monitor and can see that it opens and reads persistence.xml.

Some person filed bug having problems I have and the answer he got was that finding persistence.xml is not a source of problem.

Questions are:

  1. What can I do to make it work ?
  2. Can I make it work by skipping need for persistence.xml and just specifying pattern for .class files I want to be enhanced ?
  3. It’s more Ant question. How can I make OpenJPA enhancer to look for persistence.xml in directory other than where openjpa-2.1.1.jar resides ?
  • 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-05-27T22:24:31+00:00Added an answer on May 27, 2026 at 10:24 pm

    So I couldn’t make it work without undocumented propertiesFile. Here is version that works for me. Also specifying persistence-unit via # makes it fail with NullReferenceException.

    <target name="enhance">
        <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
            <classpath refid="library.openjpa.classpath"/>
        </taskdef>
    
        <openjpac>
            <classpath refid="library.openjpa.classpath"/>
            <classpath location="${reporting.output.dir}"/>
            <config propertiesFile = "${basedir}/src/META-INF/persistence.xml"/>
        </openjpac>
    </target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is driving me crazy. I have a PHP script that gets some data
This is driving me crazy! I have read at least 5 questions on here
This is driving me crazy already and by now I'm absolutely hopeless :( Here
This is driving me CRAZY. I have a workbook/sheet that I refer to via
This is driving me crazy. I have a script that pulls data from a
This is driving me crazy. I have a very simple user control: public int?
This is driving me crazy and I can't find the answer anywhere. I have
This is driving me crazy: I have function void gst_init(int *argc, char **argv[]); in
This is driving me crazy. I have a library I source from multiple scripts,
This is driving me crazy. I have an extension which we use to alter

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.