我刚刚转到Kodo JPA版本4.2,但进展并不顺利。
当我运行任何构建脚本时(在eclipse 3.4.1中)我得到了
BUILD FAILED
D:\My Documents\eclipseWorkspaces\cnmp e341\blue ebig\ebig\src\java\build.xml:91: <openjpa-1.1.0-r422266:657916 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.
我的build.xml位于包含persistence.xml文件的META-INF目录旁边的java目录中
这是build.xml的片段
<target name="enhance">
<echo>base dir is ${basedir}</echo>
<!-- define the kodoc task; this can be done at the top of the -->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="kodoc" classname="kodo.ant.PCEnhancerTask"/>
<!-- invoke enhancer on all .jdo files below the current directory -->
<kodoc>
<fileset dir=".">
<include name="**/jpa/*.java" />
<include name="**/jpa/*.class" />
</fileset>
<classpath>
<pathelement location="${basedir}"/>
</classpath>
</kodoc>
</target>
实体类文件位于jpa目录中。所以目录结构如下所示:
+ top
+ src
+ java
| + com
| + splat
| | + jpa
| | - entity.java
| | + stuff
| - Object.java
| + META-INF
| - persistence.xml
- build.xml
我以为我按照了文档中的说明,但显然我没有。
由于
答案 0 :(得分:0)
通过添加config propertiesFile =“../../ config / ebig.kodo.properties”/&gt;修复此问题。 它现在看起来像
<kodoc>
<config propertiesFile="../../config/ebig.kodo.properties"/>
<fileset dir=".">
<include name="**/jpa/*.java" />
<include name="**/jpa/*.class" />
</fileset>
<classpath>
<pathelement location="${basedir}"/>
</classpath>
</kodoc>