nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dean <tim.d...@gmail.com>
Subject Re: ClassNotFound exception for JSON provider within NiFi custom processor
Date Tue, 21 May 2019 14:37:54 GMT
We are using the Gradle plugin from https://github.com/sponiro/gradle-nar-plugin to cover all
of the things that the Maven NAR plugin does. And it has worked perfectly to this point on
our ~5 controller service and ~20 custom processors. That does not, of course, guarantee that
it works on every nar file, but it does seem unlikely that it would be at fault in this one
case while working for all our other use cases.

-Tim

Sent from my iPad

> On May 21, 2019, at 9:22 AM, Mike Thomsen <mikerthomsen@gmail.com> wrote:
> 
> > in the gradle build file
> 
> Are you manually making Gradle do all of the packaging work that the Maven NAR plugin
does? If not, that's probably a lot of the problem right there.
> 
>> On Tue, May 21, 2019 at 10:19 AM Tim Dean <tim.dean@gmail.com> wrote:
>> 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