nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Payne <marka...@hotmail.com>
Subject Re: OnStopped annotation
Date Tue, 01 Mar 2016 17:38:26 GMT
Pierre,

This feels to me like it could potentially be a classpath issue. The nifi-api.jar file is
on the
root class path (exists in $NIFI_HOME/lib). If there is a different class definition in your
processor,
then it will not find the annotation.

If you are deploying your processor as a NAR, though, the maven nar plugin should prevent
you
from bundling the nifi-api.jar into the nar. It may be worth while though to poke around and
make sure
that you don't have two copies of the OnStopped annotation class defined in the classpath,
though.

Thanks
-Mark



> On Mar 1, 2016, at 12:15 PM, Pierre Villard <pierre.villard.fr@gmail.com> wrote:
> 
> Nice! I used your nifi-ide-integration project to launch Nifi from my IDE
> and I reproduced the issue just by starting/stopping the processor (with a
> breakpoint in ReflectionUtils). I'll try to find some time to reproduce it
> in a unit test if this can help to find the issue.
> 
> Pierre
> 
> 2016-03-01 13:56 GMT+01:00 Oleg Zhurakousky <ozhurakousky@hortonworks.com>:
> 
>> Pierre
>> 
>> You can simplify your interactive debugging and do it right from IDE
>> https://github.com/olegz/nifi-ide-integration/
>> Just make sure that versioning in Gradle reflects current version.
>> I’ll update as well when I get a chance.
>> 
>> Oleg
>> 
>> On Mar 1, 2016, at 4:47 AM, Pierre Villard <pierre.villard.fr@gmail.com
>> <mailto:pierre.villard.fr@gmail.com>> wrote:
>> 
>> No it is not in a unit test, I remotely attached my Eclipse in debug mode
>> to my deployed Nifi instance.
>> I can try to code a unit test and reproduce the issue using the example you
>> gave.
>> 
>> 2016-02-29 18:22 GMT+01:00 Oleg Zhurakousky <ozhurakousky@hortonworks.com
>> <mailto:ozhurakousky@hortonworks.com>>:
>> 
>> I meant could you share the test code (via github)
>> 
>> On Feb 29, 2016, at 12:18 PM, Oleg Zhurakousky <
>> ozhurakousky@hortonworks.com<mailto:ozhurakousky@hortonworks.com>> wrote:
>> 
>> Ok, so you are invoking ‘quietlyInvokeMethodsWithAnnotations’ in your
>> test code?
>> If so could you your test code where you invoke it? I have a hunch, but
>> want to look before I speculate.
>> 
>> Cheers
>> Oleg
>> On Feb 29, 2016, at 11:58 AM, Pierre Villard <
>> pierre.villard.fr@gmail.com<mailto:pierre.villard.fr@gmail.com>> wrote:
>> 
>> I just wanted to test the processors with local SNMP set-up and I
>> noticed
>> that modification of properties in my processor didn't have any effect.
>> So I switched to debug, added a processor, started it, and stopped it
>> just
>> after. Conclusion: my close() method is never called.
>> I correctly go through quietlyInvokeMethodsWithAnnotations() in
>> ReflectionUtils but since the method is not seen as annotated, the close
>> method is not called.
>> 
>> Thanks,
>> Pierre
>> 
>> 2016-02-28 22:24 GMT+01:00 Oleg Zhurakousky <
>> ozhurakousky@hortonworks.com<mailto:ozhurakousky@hortonworks.com>>:
>> 
>> I am puzzled as I can’t see how can it not work.
>> Are there steps to reproduce it? I am trying to read into your initial
>> email and suspecting you were doing some sort of testing, so want to
>> make
>> sure I am doing the same thing. . . .
>> 
>> Oleg
>> On Feb 28, 2016, at 2:46 PM, Pierre Villard <
>> pierre.villard.fr@gmail.com<mailto:pierre.villard.fr@gmail.com>>
>> wrote:
>> 
>> No I am not under testing framework, all my unit tests are OK. I
>> wanted
>> to
>> perform some additional tests and deployed Nifi with the new
>> processors.
>> 
>> You can find the method here [1] if you want to have a look.
>> Thanks for your help.
>> 
>> [1]
>> 
>> 
>> 
>> https://github.com/pvillard31/nifi/blob/NIFI-1537/nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/AbstractSNMPProcessor.java#L212-L243
>> 
>> 2016-02-28 17:11 GMT+01:00 Oleg Zhurakousky <
>> ozhurakousky@hortonworks.com>:
>> 
>> Also, reading Aldrin’s response and assuming you are using Test
>> mocks I
>> would probably recommend to not use them for tests that require full
>> lifecycle test of the component until we actually improve it.
>> Instead you can code straight agains FlowController essentially
>> executing
>> as a full blown NiFi minus UI. Here is an example:
>> 
>> 
>> 
>> https://github.com/apache/nifi/pull/210/files#diff-7be646c38c5447f7824e444343633829R92
>> 
>> Cheers
>> Oleg
>> 
>> On Feb 28, 2016, at 11:07 AM, Oleg Zhurakousky <
>> ozhurakousky@hortonworks.com<mailto:ozhurakousky@hortonworks.com>>
>> wrote:
>> 
>> Pierre
>> Can you paste the method definition? Just want to look at the
>> signature
>> and see if there is something obvious
>> 
>> Sent from my iPhone
>> 
>> On Feb 28, 2016, at 10:26, Pierre Villard <
>> pierre.villard.fr@gmail.com
>> <mailto:pierre.villard.fr@gmail.com>> wrote:
>> 
>> Hi,
>> 
>> I am working on SNMP processors [1] and I'm almost ready for a PR...
>> but I
>> have an issue I can't explain. In my processors, I have implemented a
>> method close() with the @OnStopped annotation but it seems the
>> annotation
>> is not seen. When debugging and stopping my processor, I correctly go
>> through quietlyInvokeMethodsWithAnnotations() in ReflectionUtils and
>> my
>> method close() appears without any annotation. I guess I am missing
>> something simple. Any idea?
>> 
>> [1] https://issues.apache.org/jira/browse/NIFI-1537
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 


Mime
View raw message