So I just noticed that my persistent classes are not being made persistence
capable, rather they are being enhanced as persistence aware.
The message from the OpenJPA enhancer is:
No metadata was found for 181 classes; they have been enhanced as
persistence-aware. If you intended for any of these classes to be
persistence-capable, then this means that OpenJPA could not find any metadata
for those classes. This can happen if the directory containing your metadata is
not in your CLASSPATH, or if your metadata files are not named properly
My persistence.xml is in:
target/classes/META-INF/persistence.xml
All classes that should be enhanced are listed in this file.
I’m running the maven plugin as follows:
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<configuration>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
So I’m kind of at a loss as to how things are going pear shaped here. I tried
adding:
<persistenceXmlFile>${project.build.directory}/classes/META-INF/persistence.xml</persistenceXmlFile>
To the configuration, but that doesn’t change the result.
Running with -X, I see:
[DEBUG] Configuring mojo org.apache.openjpa:openjpa-maven-plugin:2.3.0:enhance
from plugin realm
ClassRealm[plugin>org.apache.openjpa:openjpa-maven-plugin:2.3.0, parent:
sun.misc.Launcher$AppClassLoader@6e66da2c]
[DEBUG] Configuring mojo
'org.apache.openjpa:openjpa-maven-plugin:2.3.0:enhance' with basic configurator
-->
[DEBUG] (f) addDefaultConstructor = true
[DEBUG] (f) classes =
/Users/hhildebrand/git/Ultrastructure/model/target/classes
[DEBUG] (f) compileClasspathElements =
[/Users/hhildebrand/git/Ultrastructure/model/target/classes,
/Users/hhildebrand/.m2/repository/com/fasterxml/uuid/java-uuid-generator/3.1.3/java-uuid-generator-3.1.3.jar,
/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.1/jackson-annotations-2.3.1.jar,
/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.1/jackson-databind-2.3.1.jar,
/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.1/jackson-core-2.3.1.jar,
/Users/hhildebrand/.m2/repository/org/apache/openjpa/openjpa-all/2.3.0/openjpa-all-2.3.0.jar,
/Users/hhildebrand/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar,
/Users/hhildebrand/.m2/repository/org/reflections/reflections/0.9.5/reflections-0.9.5.jar,
/Users/hhildebrand/.m2/repository/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar,
/Users/hhildebrand/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar,
/Users/hhildebrand/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar]
[DEBUG] (f) enforcePropertyRestrictions = true
[DEBUG] (f) forceMojoExecution = false
[DEBUG] (f) includes = **/*.class
[DEBUG] (f) project = MavenProject:
com.chiralbehaviors.CoRE:model:0.0.2-SNAPSHOT @
/Users/hhildebrand/git/Ultrastructure/model/pom.xml
[DEBUG] (f) skip = false
[DEBUG] (f) tmpClassLoader = false
[DEBUG] (f) workDir =
/Users/hhildebrand/git/Ultrastructure/model/target/openjpa-work
[DEBUG] -- end configuration --
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/git/Ultrastructure/model/target/classes/
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/com/fasterxml/uuid/java-uuid-generator/3.1.3/java-uuid-generator-3.1.3.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.1/jackson-annotations-2.3.1.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.1/jackson-databind-2.3.1.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.1/jackson-core-2.3.1.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/org/apache/openjpa/openjpa-all/2.3.0/openjpa-all-2.3.0.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/org/reflections/reflections/0.9.5/reflections-0.9.5.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
[DEBUG] Added classpathElement URL
file:/Users/hhildebrand/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
260 CoRE INFO [main] openjpa.Tool - Enhancer running on type "class
com.chiralbehaviors.CoRE.agency.AgencyNetwork_”.
If I add the persistenceXmlFile configuration to the mix, this changes to:
[DEBUG] Configuring mojo org.apache.openjpa:openjpa-maven-plugin:2.3.0:enhance
from plugin realm
ClassRealm[plugin>org.apache.openjpa:openjpa-maven-plugin:2.3.0, parent:
sun.misc.Launcher$AppClassLoader@6e66da2c]
[DEBUG] Configuring mojo
'org.apache.openjpa:openjpa-maven-plugin:2.3.0:enhance' with basic configurator
-->
[DEBUG] (f) addDefaultConstructor = true
[DEBUG] (f) classes =
/Users/hhildebrand/git/Ultrastructure/model/target/classes
[DEBUG] (f) compileClasspathElements =
[/Users/hhildebrand/git/Ultrastructure/model/target/classes,
/Users/hhildebrand/.m2/repository/com/fasterxml/uuid/java-uuid-generator/3.1.3/java-uuid-generator-3.1.3.jar,
/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.1/jackson-annotations-2.3.1.jar,
/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.1/jackson-databind-2.3.1.jar,
/Users/hhildebrand/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.1/jackson-core-2.3.1.jar,
/Users/hhildebrand/.m2/repository/org/apache/openjpa/openjpa-all/2.3.0/openjpa-all-2.3.0.jar,
/Users/hhildebrand/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar,
/Users/hhildebrand/.m2/repository/org/reflections/reflections/0.9.5/reflections-0.9.5.jar,
/Users/hhildebrand/.m2/repository/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar,
/Users/hhildebrand/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar,
/Users/hhildebrand/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar]
[DEBUG] (f) enforcePropertyRestrictions = true
[DEBUG] (f) forceMojoExecution = false
[DEBUG] (f) includes = **/*.class
[DEBUG] (f) persistenceXmlFile =
/Users/hhildebrand/git/Ultrastructure/model/target/classes/META-INF/persistence.xml
[DEBUG] (f) project = MavenProject:
com.chiralbehaviors.CoRE:model:0.0.2-SNAPSHOT @
/Users/hhildebrand/git/Ultrastructure/model/pom.xml
[DEBUG] (f) skip = false
[DEBUG] (f) tmpClassLoader = false
[DEBUG] (f) workDir =
/Users/hhildebrand/git/Ultrastructure/model/target/openjpa-work
[DEBUG] -- end configuration --
[DEBUG] using special persistence XML file:
/Users/hhildebrand/git/Ultrastructure/model/target/classes/META-INF/persistence.xml
Any pointers or guidance anyone has would be greatly appreciated.