You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Ramaninder Singh Jhajj <jh...@gmail.com> on 2018/06/12 21:46:14 UTC

Issue with http-notification service

Hello NiFi Team,

I am trying to setup NiFi lifecycle notifications in the bootstrap.conf
file. But instead of sending email notifications I want to send
notifications on slack so I thought of using http-notification.

I have configured the bootstrap-notification-services.xml with the slack
webhook url but it fails to send notifications. When I mention url with
https it throughts the following error:

2018-06-12 21:29:04,791 ERROR [Notification Service Dispatcher]
o.a.n.b.NotificationServiceManager Failed to send notification of type
NIFI_STOPPED to HttpNotificationService[id=http-notification] with Subject
NiFi Stopped on Host nifi (127.0.1.1) due to
org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
to send Http Notification. Will

2018-06-12 21:29:04,792 ERROR [Notification Service Dispatcher]
o.a.n.b.NotificationServiceManager

org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
to send Http Notification

at
org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:239)

at
org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)

at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)

at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

*Caused by: java.lang.NullPointerException: null*

at
org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:228)

... 8 common frames omitted


if I change the url to http then it thoughts 400 error:

2018-06-12 21:33:29,346 ERROR [Notification Service Dispatcher]
o.a.n.b.NotificationServiceManager

org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
to send Http Notification. Received an unsuccessful status code response
'400'. The message was 'Bad Request'

at
org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:233)

at
org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)

at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)

at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)



Anyone have any idea how I can get this to work or do I have to stick with
email.

One workaround I can think of is to setup a flow to listen to HTTP on the
canvas and pass it to PutSlack processor but I do not want to do that as it
will be unnecessary one more dependency.

Kind Regards,
Raman

Re: Issue with http-notification service

Posted by Koji Kawamura <ij...@gmail.com>.
Hi Raman,

Since you're using 'https' endpoint, I believe you need to configure
HttpNotificationService with trust store settings.
The NullPointerException can happen if OkHttpClient is null when the
notification service tries to send notifications, that can happen if
OkHttpClient is not initialized correctly. I assume there is another
error log message prior to the NPE.

Please check out this documentation on what properties you need to set
such as 'Truststore Filename'
https://nifi.apache.org/docs.html

Thanks,
Koji


On Fri, Jun 22, 2018 at 4:15 AM, Ramaninder Singh Jhajj
<jh...@gmail.com> wrote:
> Hi Andy,
>
> I am using version 1.6.0 as a single instance on my local MacBook pro.
>
> The configuration of bootstrap-notification-services.xml file is:
>
>      <service>
>
>         <id>http-notification</id>
>
>
> <class>org.apache.nifi.bootstrap.notification.http.HttpNotificationService</class>
>
>         <property
> name="URL">https://hooks.slack.com/services/ID_OF_THE_SLAC_WEBHOOK</property>
>
>      </service>
>
>
>
> Can it be due to slack url being https?
>
> I am still not able to figure it out. So any help will be really useful.
>
> Kind Regards,
> Raman
>
>
> On Tue, Jun 12, 2018 at 5:30 PM Andy LoPresto <al...@apache.org> wrote:
>>
>> Hi Raman,
>>
>> What version of Apache NiFi are you using? In current master, that line
>> (HttpNotificationService.java:228) is a blank line [1]. Can you also share
>> the contents of your bootstrap-notification-services.xml file (redacting
>> sensitive information if necessary)?
>>
>>
>> [1]
>> https://github.com/apache/nifi/blob/master/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/notification/http/HttpNotificationService.java#L228
>>
>> Andy LoPresto
>> alopresto@apache.org
>> alopresto.apache@gmail.com
>> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
>>
>> On Jun 12, 2018, at 2:46 PM, Ramaninder Singh Jhajj
>> <jh...@gmail.com> wrote:
>>
>> Hello NiFi Team,
>>
>> I am trying to setup NiFi lifecycle notifications in the bootstrap.conf
>> file. But instead of sending email notifications I want to send
>> notifications on slack so I thought of using http-notification.
>>
>> I have configured the bootstrap-notification-services.xml with the slack
>> webhook url but it fails to send notifications. When I mention url with
>> https it throughts the following error:
>>
>> 2018-06-12 21:29:04,791 ERROR [Notification Service Dispatcher]
>> o.a.n.b.NotificationServiceManager Failed to send notification of type
>> NIFI_STOPPED to HttpNotificationService[id=http-notification] with Subject
>> NiFi Stopped on Host nifi (127.0.1.1) due to
>> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
>> to send Http Notification. Will
>> 2018-06-12 21:29:04,792 ERROR [Notification Service Dispatcher]
>> o.a.n.b.NotificationServiceManager
>> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
>> to send Http Notification
>> at
>> org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:239)
>> at
>> org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)
>> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>> at java.lang.Thread.run(Thread.java:748)
>> Caused by: java.lang.NullPointerException: null
>> at
>> org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:228)
>> ... 8 common frames omitted
>>
>>
>> if I change the url to http then it thoughts 400 error:
>>
>> 2018-06-12 21:33:29,346 ERROR [Notification Service Dispatcher]
>> o.a.n.b.NotificationServiceManager
>> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
>> to send Http Notification. Received an unsuccessful status code response
>> '400'. The message was 'Bad Request'
>> at
>> org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:233)
>> at
>> org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)
>> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
>> at
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>> at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>> at java.lang.Thread.run(Thread.java:748)
>>
>>
>>
>> Anyone have any idea how I can get this to work or do I have to stick with
>> email.
>>
>> One workaround I can think of is to setup a flow to listen to HTTP on the
>> canvas and pass it to PutSlack processor but I do not want to do that as it
>> will be unnecessary one more dependency.
>>
>> Kind Regards,
>> Raman
>>
>>
>

Re: Issue with http-notification service

Posted by Ramaninder Singh Jhajj <jh...@gmail.com>.
Hi Andy,

I am using version 1.6.0 as a single instance on my local MacBook pro.

The configuration of bootstrap-notification-services.xml file is:

     <service>

        <id>http-notification</id>


<class>org.apache.nifi.bootstrap.notification.http.HttpNotificationService</class>

        <property name="URL">
https://hooks.slack.com/services/ID_OF_THE_SLAC_WEBHOOK</property>

     </service>


Can it be due to slack url being https?

I am still not able to figure it out. So any help will be really useful.

Kind Regards,
Raman


On Tue, Jun 12, 2018 at 5:30 PM Andy LoPresto <al...@apache.org> wrote:

> Hi Raman,
>
> What version of Apache NiFi are you using? In current master, that line
> (HttpNotificationService.java:228) is a blank line [1]. Can you also share
> the contents of your bootstrap-notification-services.xml file (redacting
> sensitive information if necessary)?
>
>
> [1]
> https://github.com/apache/nifi/blob/master/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/notification/http/HttpNotificationService.java#L228
>
> Andy LoPresto
> alopresto@apache.org
> *alopresto.apache@gmail.com <al...@gmail.com>*
> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
>
> On Jun 12, 2018, at 2:46 PM, Ramaninder Singh Jhajj <
> jhajj.raman094@gmail.com> wrote:
>
> Hello NiFi Team,
>
> I am trying to setup NiFi lifecycle notifications in the bootstrap.conf
> file. But instead of sending email notifications I want to send
> notifications on slack so I thought of using http-notification.
>
> I have configured the bootstrap-notification-services.xml with the slack
> webhook url but it fails to send notifications. When I mention url with
> https it throughts the following error:
>
> 2018-06-12 21:29:04,791 ERROR [Notification Service Dispatcher]
> o.a.n.b.NotificationServiceManager Failed to send notification of type
> NIFI_STOPPED to HttpNotificationService[id=http-notification] with Subject
> NiFi Stopped on Host nifi (127.0.1.1) due to
> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
> to send Http Notification. Will
> 2018-06-12 21:29:04,792 ERROR [Notification Service Dispatcher]
> o.a.n.b.NotificationServiceManager
> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
> to send Http Notification
> at
> org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:239)
> at
> org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> *Caused by: java.lang.NullPointerException: null*
> at
> org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:228)
> ... 8 common frames omitted
>
>
> if I change the url to http then it thoughts 400 error:
>
> 2018-06-12 21:33:29,346 ERROR [Notification Service Dispatcher]
> o.a.n.b.NotificationServiceManager
> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed
> to send Http Notification. Received an unsuccessful status code response
> '400'. The message was 'Bad Request'
> at
> org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:233)
> at
> org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
>
>
>
> Anyone have any idea how I can get this to work or do I have to stick with
> email.
>
> One workaround I can think of is to setup a flow to listen to HTTP on the
> canvas and pass it to PutSlack processor but I do not want to do that as it
> will be unnecessary one more dependency.
>
> Kind Regards,
> Raman
>
>
>

Re: Issue with http-notification service

Posted by Andy LoPresto <al...@apache.org>.
Hi Raman,

What version of Apache NiFi are you using? In current master, that line (HttpNotificationService.java:228) is a blank line [1]. Can you also share the contents of your bootstrap-notification-services.xml file (redacting sensitive information if necessary)?


[1] https://github.com/apache/nifi/blob/master/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/notification/http/HttpNotificationService.java#L228 <https://github.com/apache/nifi/blob/master/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/notification/http/HttpNotificationService.java#L228>

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Jun 12, 2018, at 2:46 PM, Ramaninder Singh Jhajj <jh...@gmail.com> wrote:
> 
> Hello NiFi Team,
> 
> I am trying to setup NiFi lifecycle notifications in the bootstrap.conf file. But instead of sending email notifications I want to send notifications on slack so I thought of using http-notification.
> 
> I have configured the bootstrap-notification-services.xml with the slack webhook url but it fails to send notifications. When I mention url with https it throughts the following error:
> 
> 2018-06-12 21:29:04,791 ERROR [Notification Service Dispatcher] o.a.n.b.NotificationServiceManager Failed to send notification of type NIFI_STOPPED to HttpNotificationService[id=http-notification] with Subject NiFi Stopped on Host nifi (127.0.1.1) due to org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed to send Http Notification. Will
> 2018-06-12 21:29:04,792 ERROR [Notification Service Dispatcher] o.a.n.b.NotificationServiceManager
> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed to send Http Notification
> 	at org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:239)
> 	at org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> 	at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.NullPointerException: null
> 	at org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:228)
> 	... 8 common frames omitted
> 
> 
> if I change the url to http then it thoughts 400 error:
> 
> 2018-06-12 21:33:29,346 ERROR [Notification Service Dispatcher] o.a.n.b.NotificationServiceManager
> org.apache.nifi.bootstrap.notification.NotificationFailedException: Failed to send Http Notification. Received an unsuccessful status code response '400'. The message was 'Bad Request'
> 	at org.apache.nifi.bootstrap.notification.http.HttpNotificationService.notify(HttpNotificationService.java:233)
> 	at org.apache.nifi.bootstrap.NotificationServiceManager$2.run(NotificationServiceManager.java:206)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> 	at java.lang.Thread.run(Thread.java:748)
> 
> 
> 
> Anyone have any idea how I can get this to work or do I have to stick with email.
> 
> One workaround I can think of is to setup a flow to listen to HTTP on the canvas and pass it to PutSlack processor but I do not want to do that as it will be unnecessary one more dependency.
> 
> Kind Regards,
> Raman