我正在使用使用 ANT 的 OpenJPA 的构建时间增强功能。这是项目结构
TestOpenJPA
+ src
| + in
| | + ns
| | | xxx.java
| + META-INF
| | persistence.xml
+ build
+ dist
+ OpenJPA_lib_jar
| openjpa-all-2.2.0.jar
+ build.xml
build.xml
这是文件中的增强代码段
<!-- 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" />
当我在 Eclipse(靛蓝)中构建项目时,输出中出现以下异常。
[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
谁能告诉我什么是