2014-04-22 38 views
1

我在这里找到了一些有关该主题的主题,但没有任何建议对我有用。Netbeans 8 + maven + OpenJPA部署到TomEE - 增强失败

我正尝试使用Netbeans 8.0在TomEE 1.6.0.1上创建一个简单的“web profile”Java EE应用程序。只想连接到一个mysql数据库并显示一些数据来获得它的感觉。

我不能让过去的这个错误:

Failed to execute goal org.apache.openjpa:openjpa-maven-plugin:2.2.2:enhance (enhancer) on project TomEETestMaven: Execution enhancer of goal org.apache.openjpa:openjpa-maven-plugin:2.2.2:enhance failed: 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. -> [Help 1]

以下是我加入pom.xml的增强插件,在网站的OpenJPA以下最新资料:

 <plugin> 
     <groupId>org.apache.openjpa</groupId> 
     <artifactId>openjpa-maven-plugin</artifactId> 
     <version>2.2.2</version> 
     <configuration> 
      <includes>com/myapp/tomeetestmaven/**/*.class</includes> 
     </configuration> 
     <executions> 
      <execution> 
      <id>enhancer</id> 
      <phase>process-classes</phase> 
      <goals> 
       <goal>enhance</goal> 
      </goals> 
      </execution> 
     </executions> 
     <dependencies> 
      <dependency> 
      <groupId>org.apache.openjpa</groupId> 
      <artifactId>openjpa-maven-plugin</artifactId> 
      <version>2.2.2</version> 
      </dependency> 
     </dependencies> 
     </plugin> 

我在那里有冲突的报告,有人说这是一个错误,其他人说persistence.xml文件必须在类路径中(但由于它已经在src/main/resources/META-INF中,它是安全的吗?)我试着将它移动到src/main/java但错误是相同的。

经过几天的疯狂谷歌搜索和测试,我很难过。任何帮助将不胜感激,谢谢。

+0

老实说,我会采取任何方式我可以得到它。我没有和Maven结婚。我在非Maven(Ant)Web项目中尝试了这一点,并得到我的类需要增强的错误。我可以通过任何方式克服这个增强障碍。 –

+0

发现了这一点有:http://markmail.org/message/vegc4a4brsinscoh 我编辑catalina.properties并加入这一行:openejb.jpa.deploy-时间增强=真 不走运......无影响。 –

回答

2

明白了,在他的博客上与一位有帮助的同事来回之后。您必须将此行添加到/conf/system.properties:

openejb.jpa.deploy-time-enhancement=true