nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dean <tim.d...@gmail.com>
Subject ClassNotFound exception for JSON provider within NiFi custom processor
Date Tue, 21 May 2019 14:19:35 GMT
Hello,

I have a custom NiFi processor and controller service that makes use of the JSON streaming
API, as defined by JSR-374. This API is defined by an API jar file and requires a separate
jar file with an implementation of the API. I have chosen to use the Glassfish reference implementation.
 As a result, I have the following dependencies in the gradle build file for both my controller
service and my processor nar files:

> compile group: ‘javax.json’, name: ‘javax.json-api’, version: ‘1.1.4’
> compile group: ‘org.glassfish’, name: ‘javax.json’, version: ‘1.1.4’

My processor’s nar file is a child of the controller service API’s nar file, as is the
nar file for the controller service’s implementation.

When my processor runs, it gets its controller service reference and then calls a method on
that controller service. That method’s implementation tries to instantiate a JSON parser,
but gets a ClassNotFoundException. It cannot find the class “org.glassfish.json.JsonProviderImpl”
- a class that I have confirmed exists in the javax.json-1.1.4.jar file.

I have looked in the /opt/nifi-1.8/work/nar/extensions/<my-nar-file>-unpacked/NAR-INF/bundled-dependencies/
directories for both the controller service implementation and for the processor nar files.
Both appear to be receiving the javax.json and the javax.json-api jar files.

Running both the controller service implementation and the processor works fine in my unit
tests.

I suspect that there must be something I’m missing with nar file class loaders at play here,
but I have been unable to figure out how to fix this problem.

I’d appreciate any feedback on what I might be doing wrong here.

Thanks

-Tim
Mime
View raw message