nuxeo

Nuxeo automation and a custom enricher


I'm trying to learn how to develop my own enricher (I believe I do understand the basic, in terms of how enrichers relate to automation chains and so on). However, I'm having problems:

Any help is welcome!

Log link: https://answers.nuxeo.com/api/files/2b14d403-aa8a-4ac3-81ca-c9ee13623c2a

I've also asked the same question here:

https://answers.nuxeo.com/general/q/af5a6369c91942b5a81bf61549b467f2/Automation-and-a-custom-enricher


Solution

  • Make sure that you are compiling the enricher code with the same version of Nuxeo libraries as is the version of the target platform.

    For example sample project is using the latest version (currently 11.1-SNAPSHOT) and the result code will not be compatible with Nuxeo platform 9.2. Especially abstract methods can have problems.

    So there should be this section in pom.xml with <version>9.2</version> in your case:

    <parent>
        <groupId>org.nuxeo</groupId>
        <artifactId>nuxeo-addons-parent</artifactId>
        <version>9.2</version>
    </parent>
    

    The reason why the java.lang.AbstractMethodError is thrown here is in JsonGenerator. Nuxeo 9.2 uses org.codehaus.jackson.JsonGenerator while newer Nuxe versions use com.fasterxml.jackson.core.JsonGenerator.

    Then this method signature (in 9.2):

    public void write(org.codehaus.jackson.JsonGenerator jsonGenerator, DocumentModel documentModel) throws IOException;
    

    ... is not compatible with this (in 10.3 for example):

    public void write(com.fasterxml.jackson.core.JsonGenerator json, DocumentModel document) throws IOException;
    

    And Java is then not able to find correct write() method implementation and throws AbstractMethodError.