You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Pushkara R <pu...@gmail.com> on 2017/02/28 07:01:27 UTC

Need help with Custom Processor

Hi,

I'm writing a new processor for NiFi which has a dependency on an external
library. When I build the NAR and add it to the lib folder and restart
NiFi, the external library classes that my processor depends on fail
getting loaded with a "ClassNotFound" exception.

How do I go about fixing this issue? Do I add the jar for the external
library separately in the lib folder of NiFi? Or is there something else to
it?

Thanks
Pushkar

Re: Need help with Custom Processor

Posted by Andrew Psaltis <ps...@gmail.com>.
Hi Pushkar,
By chance is the "A" dependency marked with a scope in "B"'s pom, such as
test, compile, or provided? If so then you would want to include "A" in
your pom as a dependency. As long as "A" is not marked with a scope that
excludes it from "B"'s final packaging or it is not excluded by one of the
maven packaging plugins then it should pick up the dependency and include
it in your NAR when you package your processor. If "A" is indeed marked
with a scope that prevents it from being included in the final NAR, you
would either want to modify B's pom or explicitly add it as a dependency to
your pom file.

Thanks,
Andrew

On Tue, Feb 28, 2017 at 2:56 PM, Pushkara R <pu...@gmail.com> wrote:

> Hi Andrew,
>
> The particular class that isn't being found is part of an artifact (let's
> call it A) which is a dependency of another artifact B that my processors
> depend on. A is in B's pom file and B is in my processors' pom file. Yet I
> am getting the class not found issue.
>
> I am currently working by adding A's jar in the lib folder as I am only
> doing a few benchmarks on NiFi. But please do let me know how I could fix
> this problem.
>
> Regards
> Pushkar
>
> On Tue, Feb 28, 2017 at 12:40 PM, Andrew Psaltis <psaltis.andrew@gmail.com
> >
> wrote:
>
> > Hi Pushkar,
> > The preferred approach is to add the external dependency to the pom file
> > for your processor. After doing that when you build your nar bundle, the
> > resulting nar file will contain all of the 3rd party dependencies
> required
> > by your processor. Can you double check that you are indeed including it
> as
> > a maven dependency?
> >
> > Thanks,
> > Andrew
> >
> >
> > On Tue, Feb 28, 2017 at 12:31 PM, Pushkara R <pu...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I'm writing a new processor for NiFi which has a dependency on an
> > external
> > > library. When I build the NAR and add it to the lib folder and restart
> > > NiFi, the external library classes that my processor depends on fail
> > > getting loaded with a "ClassNotFound" exception.
> > >
> > > How do I go about fixing this issue? Do I add the jar for the external
> > > library separately in the lib folder of NiFi? Or is there something
> else
> > to
> > > it?
> > >
> > > Thanks
> > > Pushkar
> > >
> >
> >
> >
> > --
> > Thanks,
> > Andrew
> >
> > Subscribe to my book: Streaming Data <http://manning.com/psaltis>
> > <https://www.linkedin.com/pub/andrew-psaltis/1/17b/306>
> > twiiter: @itmdata <http://twitter.com/intent/user?screen_name=itmdata>
> >
>



-- 
Thanks,
Andrew

Subscribe to my book: Streaming Data <http://manning.com/psaltis>
<https://www.linkedin.com/pub/andrew-psaltis/1/17b/306>
twiiter: @itmdata <http://twitter.com/intent/user?screen_name=itmdata>

Re: Need help with Custom Processor

Posted by Pushkara R <pu...@gmail.com>.
Hi Andrew,

The particular class that isn't being found is part of an artifact (let's
call it A) which is a dependency of another artifact B that my processors
depend on. A is in B's pom file and B is in my processors' pom file. Yet I
am getting the class not found issue.

I am currently working by adding A's jar in the lib folder as I am only
doing a few benchmarks on NiFi. But please do let me know how I could fix
this problem.

Regards
Pushkar

On Tue, Feb 28, 2017 at 12:40 PM, Andrew Psaltis <ps...@gmail.com>
wrote:

> Hi Pushkar,
> The preferred approach is to add the external dependency to the pom file
> for your processor. After doing that when you build your nar bundle, the
> resulting nar file will contain all of the 3rd party dependencies required
> by your processor. Can you double check that you are indeed including it as
> a maven dependency?
>
> Thanks,
> Andrew
>
>
> On Tue, Feb 28, 2017 at 12:31 PM, Pushkara R <pu...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I'm writing a new processor for NiFi which has a dependency on an
> external
> > library. When I build the NAR and add it to the lib folder and restart
> > NiFi, the external library classes that my processor depends on fail
> > getting loaded with a "ClassNotFound" exception.
> >
> > How do I go about fixing this issue? Do I add the jar for the external
> > library separately in the lib folder of NiFi? Or is there something else
> to
> > it?
> >
> > Thanks
> > Pushkar
> >
>
>
>
> --
> Thanks,
> Andrew
>
> Subscribe to my book: Streaming Data <http://manning.com/psaltis>
> <https://www.linkedin.com/pub/andrew-psaltis/1/17b/306>
> twiiter: @itmdata <http://twitter.com/intent/user?screen_name=itmdata>
>

Re: Need help with Custom Processor

Posted by Andrew Psaltis <ps...@gmail.com>.
Hi Pushkar,
The preferred approach is to add the external dependency to the pom file
for your processor. After doing that when you build your nar bundle, the
resulting nar file will contain all of the 3rd party dependencies required
by your processor. Can you double check that you are indeed including it as
a maven dependency?

Thanks,
Andrew


On Tue, Feb 28, 2017 at 12:31 PM, Pushkara R <pu...@gmail.com> wrote:

> Hi,
>
> I'm writing a new processor for NiFi which has a dependency on an external
> library. When I build the NAR and add it to the lib folder and restart
> NiFi, the external library classes that my processor depends on fail
> getting loaded with a "ClassNotFound" exception.
>
> How do I go about fixing this issue? Do I add the jar for the external
> library separately in the lib folder of NiFi? Or is there something else to
> it?
>
> Thanks
> Pushkar
>



-- 
Thanks,
Andrew

Subscribe to my book: Streaming Data <http://manning.com/psaltis>
<https://www.linkedin.com/pub/andrew-psaltis/1/17b/306>
twiiter: @itmdata <http://twitter.com/intent/user?screen_name=itmdata>