Automation and a custom enricher

Hi,

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:

  • I can use existing enrichers with, for example, Document.FetchByProperty and everything will work
  • But once I include my own custom enricher, I get the error (attached)
  • I couldn't figure out what I'm doing wrong, so I took existing custom enricher from Nuxeo sample project, and got the same error

Any help is welcome!

I have also asked the same question on SO.

https://stackoverflow.com/questions/55043978/nuxeo-automation-and-a-custom-enricher

1 votes

1 answers

1147 views

ANSWER



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.

BTW: I answered this question for you also on https://stackoverflow.com/a/55124006/9709361

0 votes



Thank you, I've completely missed the versions part of the deal.
04/04/2019