Улучшение класса API программ Datanucleus

Я использую Eclipse 3.7 (OSGI), и я могу сделать ручной Enhancement (с плагином Datanucleus Eclipse и выпуском datanucleus-enhancer-2.1.0, импортированным как зависимость плагина)

Теперь я пытаюсь использовать расширение класса API: http://www.datanucleus.org/products/accessplatform/jpa/enhancer.html#api

С ASM 3.1 в пути к классам и этот код:

DataNucleusEnhancer enhancer=new DataNucleusEnhancer("JDO","ASM");
enhancer.setVerbose(true);
enhancer.addClasses(...);
enhancer.enhance();

Я получаю:

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)

С кодом, предложенным в учебнике:

JDOEnhancer enhancer = JDOHelper.getEnhancer();
enhancer.setVerbose(true);
enhancer.addClasses(...);
enhancer.enhance();

Я получаю:

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.

Есть ли способ повысить класс API?

Ответы

Ответ 1

Смотрите эту ссылку http://www.datanucleus.org/products/accessplatform_3_0/enhancer.html#runtime

Особенно предложение: "Для повышения времени выполнения требуются следующие зависимости от времени выполнения: ASM и библиотеки DataNucleus Core".

Таким образом, вам, вероятно, не хватает зависимости от ASM.

Попробуйте добавить эту зависимость:

    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm</artifactId>
      <version>4.2</version>
    </dependency>