I've found a few threads here on the topic but none of the advice has worked for me.
I'm trying to create a simple "web profile" Java EE app on TomEE 1.6.0.1 using Netbeans 8.0. Just want to connect to a mysql database and display some data to get a feel for it.
I can't get past this error:
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]
Here's how I added the enhancement plugin in pom.xml, following the latest documentation on the OpenJPA site:
<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>
I'm getting conflicting reports out there, some saying it's a bug, others saying the persistence.xml file must be on the classpath (but since it's in src/main/resources/META-INF already, it's safe?) I tried moving it to src/main/java but the error was identical.
I'm stumped after a couple days of rabid Googling and testing stuff. Any help would be appreciated, thanks.
Got it, after some back-and-forth with a helpful fellow on his blog. You have to add this line to /conf/system.properties:
openejb.jpa.deploy-time-enhancement=true