I'm using Eclipse 3.7 (OSGI), and i can do the manual Enhancement (with the Datanucleus Eclipse Plugin & datanucleus-enhancer-2.1.0-release imported as plugin dependency)
I'm trying now to use the API Class Enhancement: http://www.datanucleus.org/products/accessplatform/jpa/enhancer.html#api
With ASM 3.1 in the classpath and this code:
DataNucleusEnhancer enhancer=new DataNucleusEnhancer("JDO","ASM");
enhancer.setVerbose(true);
enhancer.addClasses(...);
enhancer.enhance();
I get:
You have selected to use ClassEnhancer "ASM" yet the JAR for that enhancer does not seem to be in the CLASSPATH!
org.datanucleus.enhancer.NucleusEnhanceException: You have selected to use ClassEnhancer "ASM" yet the JAR for that enhancer does not seem to be in the CLASSPATH!
at org.datanucleus.enhancer.DataNucleusEnhancer.init(DataNucleusEnhancer.java:224)
at org.datanucleus.enhancer.DataNucleusEnhancer.addClasses(DataNucleusEnhancer.java:406)
With the code suggested in the tutorial:
JDOEnhancer enhancer = JDOHelper.getEnhancer();
enhancer.setVerbose(true);
enhancer.addClasses(...);
enhancer.enhance();
I get:
javax.jdo.JDOFatalUserException: There are 0 services entries for the JDOEnhancer; there were no valid JDOEnhancer implementations found in the CLASSPATH. The file META-INF/services/javax.jdo.JDOEnhancer should name the implementation class.
Is there a way to achieve API Class Enhancement?
See this link http://www.datanucleus.org/products/accessplatform_3_0/enhancer.html#runtime
Especially sentence: "Runtime Enhancement requires the following runtime dependencies: ASM, and DataNucleus Core libraries."
So you are probably missing ASM dependency.
Try add this dependency:
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>4.2</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With