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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:41:03+00:00 2026-06-04T22:41:03+00:00

I am using OpenJPA’s build time enhancement using ANT. Here is the project structure

  • 0

I am using OpenJPA’s build time enhancement using ANT. Here is the project structure

TestOpenJPA
+ src
| + in
| | + ns
| | | xxx.java
| + META-INF
| | persistence.xml
+ build
+ dist
+ OpenJPA_lib_jar
| openjpa-all-2.2.0.jar
+ build.xml

Here is the enhancement snippet code from build.xml file

    <!-- Define the classpath to include the necessary files. -->
<!-- ex. openjpa jars, persistence.xml, orm.xml, and target classes  -->
<path id="jpa.enhancement.classpath">
    <!-- Assuming persistence.xml/orm.xml are in META-INF -->
    <pathelement location="META-INF" />

    <!-- Location of the .class files -->
    <pathelement location="build/classes" />

    <!-- Add the openjpa jars -->
    <fileset dir="OpenJPA_lib_jar">
            <include name="*.jar" />
    </fileset>
</path>
<!-- define the openjpac task; this can be done at the top of the -->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="jpa.enhancement.classpath" />

<!-- invoke enhancer on all .class files below the model directory -->
<openjpac>
    <classpath refid="jpa.enhancement.classpath" />
    <fileset dir=".">
        <include name="**/model/*.class" />
    </fileset>
</openjpac>
<echo message="Enhancement complete" />

When I build the project in eclipse (indigo) I get following exception in the output.

[openjpac] <openjpa-2.2.0-r422266:1244990 fatal user error> 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 <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, or if your security policy is overly strict.
[openjpac]  at org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(MetaDataRepository.java:1904)
[openjpac]  at org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1885)
[openjpac]  at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
[openjpac]  at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
[openjpac]  at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
[openjpac]  at org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
[openjpac]  at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
[openjpac]  at org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:968)
[openjpac]  at org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:88)
[openjpac]  at org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:171)
[openjpac]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[openjpac]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[openjpac]  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[openjpac]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[openjpac]  at java.lang.reflect.Method.invoke(Unknown Source)
[openjpac]  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[openjpac]  at org.apache.tools.ant.Task.perform(Task.java:348)
[openjpac]  at org.apache.tools.ant.Target.execute(Target.java:390)
[openjpac]  at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
[openjpac]  at org.eclipse.ant.internal.core.ant.InternalAntRunner.parseBuildFile(InternalAntRunner.java:348)
[openjpac]  at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:634)
[openjpac]  at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:496)
[openjpac]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[openjpac]  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[openjpac]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[openjpac]  at java.lang.reflect.Method.invoke(Unknown Source)
[openjpac]  at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
[openjpac]  at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate.runInSameVM(AntLaunchDelegate.java:321)
[openjpac]  at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate.launch(AntLaunchDelegate.java:274)
[openjpac]  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
[openjpac]  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
[openjpac]  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:696)
[openjpac]  at org.eclipse.core.externaltools.internal.model.ExternalToolBuilder.launchBuild(ExternalToolBuilder.java:181)
[openjpac]  at org.eclipse.core.externaltools.internal.model.ExternalToolBuilder.doBuildBasedOnScope(ExternalToolBuilder.java:169)
[openjpac]  at org.eclipse.core.externaltools.internal.model.ExternalToolBuilder.build(ExternalToolBuilder.java:88)
[openjpac]  at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
[openjpac]  at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
[openjpac]  at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
[openjpac]  at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
[openjpac]  at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
[openjpac]  at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
[openjpac]  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

BUILD FAILED

Can anyone let me know what is

  • 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-04T22:41:06+00:00Added an answer on June 4, 2026 at 10:41 pm

    When I added <config propertiesFile = "${basedir}/src/META-INF/persistence.xml"/> in the <openjpac> tag the MetaDataException is gone. I found the solution here

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

Sidebar

Related Questions

I am using openjpa runtime of JPA specification. At development time I am using
I'm using WebSphere 7 (Java EE 5) and OpenJPA 1.2.1. I have a JPA
THere is a oracle query that I am trying to recreate using OpenJPA. I
I am using JPA with openjpa implementation beneath, on a Geronimo application server. I
I'm using WebSphere 7 and their JPA 2.0 implementation which is based on OpenJPA,
Using Java,I have to fetch multiple sets of values from an XML file to
I have an existing data model using openJPA and I am trying to integrate
I'm having trouble handling IDs of my databse tables using OpenJPA and HSQLdb. I
Is there any jpa 1.0 fluent api/interface for query building? I'm using openjpa 1.x,
I am using OpenJPA 2.1 (which implements JPA 2.0 ) for a command line

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.