Created 01-03-2018 05:32 AM
Hi,
Has anyone tried using nifi-standard-services like DBCPService in custom processor?
My custom processor works fine if i write my own code to connect to DB or keep a internal DBCP pool whereas it fails if i try to reuse DBCPService which is part of nifi-nar-bundles/nifi-standard-services. If i keep dependency in my processor as provided then processor is unable to resolve service at runtime. if i dont keep dependency as provided then service is bundled with my processor and fails to start.
Same is the case if i try using JdbcCommon class which is part of nifi-standard-processors utils.
Created 01-03-2018 04:11 PM
In order to keep the dependency as provided and use DBCPService in your processor(s), you can set the parent NAR for your nifi-custom-nar module to "nifi-standard-services-api-nar", by adding the following as a dependency to your nifi-custom-nar's pom.xml:
<dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-standard-services-api-nar</artifactId> <type>nar</type> </dependency>
Using JbdcCommon is a different issue, as it is not part of an API but rather the nifi-standard-processors JAR. This NiFi dev mailing list thread explains some workarounds, such as using nifi-standard-nar as your NAR parent, or copying JdbcCommon to your project (the latter was done for HiveJbdcCommon for that reason plus custom changes specific to Hive).
Created 01-03-2018 04:11 PM
In order to keep the dependency as provided and use DBCPService in your processor(s), you can set the parent NAR for your nifi-custom-nar module to "nifi-standard-services-api-nar", by adding the following as a dependency to your nifi-custom-nar's pom.xml:
<dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-standard-services-api-nar</artifactId> <type>nar</type> </dependency>
Using JbdcCommon is a different issue, as it is not part of an API but rather the nifi-standard-processors JAR. This NiFi dev mailing list thread explains some workarounds, such as using nifi-standard-nar as your NAR parent, or copying JdbcCommon to your project (the latter was done for HiveJbdcCommon for that reason plus custom changes specific to Hive).
Created 01-03-2018 07:51 PM
Thanks. it worked. i added services nar as dependency in my processors NAR and for JdbcCommon i copied it to my Processor.
Created 01-03-2018 08:01 PM
i also tried to add standard-processor nar as dependency but build failed. looks like only one NAR as dependency is allowed. now i understand what you meant by adding parent jar by defining it's NAR as dependency in custom NAR.