在Eclipse中增强openJPA类

时间:2011-03-09 18:30:59

标签: java eclipse apache jpa openjpa

我正在尝试通过本指南增强openJPA课程:enhancement-with-eclipse.html

出于某种原因,相同的设置在Windows中有效,但在Ubuntu中出现了这个问题。

有谁看到我做错了什么?我已将persistence.xml添加到buildpath。我已经按照指南进行了操作,但我仍然得到了这个例外:

 [openjpac] <openjpa-2.1.0-r422266:1071316 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:949)
[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(NativeMethodAccessorImpl.java:57)
[openjpac]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[openjpac]  at java.lang.reflect.Method.invoke(Method.java:616)
[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.Target.performTasks(Target.java:411)
[openjpac]  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
[openjpac]  at org.apache.tools.ant.Project.executeTarget(Project.java:1329)
[openjpac]  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[openjpac]  at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[openjpac]  at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
[openjpac]  at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:662)
[openjpac]  at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:495)
[openjpac]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[openjpac]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[openjpac]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[openjpac]  at java.lang.reflect.Method.invoke(Method.java:616)
[openjpac]  at org.eclipse.ant.core.AntRunner.run(AntRunner.java:378)
[openjpac]  at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate.runInSameVM(AntLaunchDelegate.java:277)
[openjpac]  at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate.launch(AntLaunchDelegate.java:239)
[openjpac]  at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
[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.ui.externaltools.internal.model.ExternalToolBuilder.launchBuild(ExternalToolBuilder.java:179)
[openjpac]  at org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder.doBuildBasedOnScope(ExternalToolBuilder.java:167)
[openjpac]  at org.eclipse.ui.externaltools.internal.model.ExternalToolBuilder.build(ExternalToolBuilder.java:86)
[openjpac]  at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
[openjpac]  at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
[openjpac]  at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
[openjpac]  at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
[openjpac]  at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
[openjpac]  at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:330)
[openjpac]  at org.eclipse.ui.actions.GlobalBuildAction$1.run(GlobalBuildAction.java:178)
[openjpac]  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

所有人都非常感激!

1 个答案:

答案 0 :(得分:2)

我猜你在META-INF目录或persistence.xml文件的文件名中出现了错误。因为Windows不区分大小写,所以它并不重要,但由于UNIX关心大小写,所以它在这里。