Seems like a bug in AbstractMQTTProcessor.transformSSLContextService
which assumes there will always be a keystore provided by the
SSLContextService, which is not true.

Can you create a jira for this?

On Mon, Sep 28, 2020 at 10:43 AM Jeremy Pemberton-Pigott
<fuzzych...@gmail.com> wrote:
>
> Hi,
>
> I'm trying to set up an MQTT TLS consumer in 1.12.0 with ConsumeMQTT.  I am 
> initiating the connection to a remote EMQX MQTT TLS broker.  If I configure 
> the StandardRestrictedSSLContextService for a JKS truststore only (no 
> keystore settings since it isn't required) and start the ConsumeMQTT I get 
> the below stack trace in the NiFi logs and the processor fails to start.  
> Unless I fill in the details for a keystore it won't work, so if both are 
> filled in then it connects fine.  Is this expected or a bug?
>
> I was expecting not to even have to set up the SSL context service because I 
> don't need to locally verify the remote server certificates (InvokeHTTP works 
> this way), I also don't want to maintain them, so I thought that I shouldn't 
> even need a local truststore file but the ConsumeMQTT processor with a broker 
> URI of ssl://x:38883 requires me to set it up.
>
> Processor error:
> ConsumeMQTT[id=d4f3133f-0174-1000-2d37-2fbf855ebf83] Failed to properly 
> initialize Processor. If still scheduled to run, NiFi will attempt to 
> initialize and run the Processor again after the 'Administrative Yield 
> Duration' has elapsed. Failure is due to java.lang.NullPointerException: 
> java.lang.NullPointerException
>
> Log:
> 2020-09-28 21:51:00,665 ERROR [Timer-Driven Process Thread-1] 
> o.a.nifi.processors.mqtt.ConsumeMQTT 
> ConsumeMQTT[id=d4f3133f-0174-1000-2d37-2fbf855ebf83] Failed to properly 
> initialize Processor. If still scheduled to run, NiFi will attempt to 
> initialize and run the Processor again after the 'Administrative Yield 
> Duration' has elapsed. Failure is due to java.lang.NullPointerException: 
> java.lang.NullPointerException
> java.lang.NullPointerException: null
> at java.util.Hashtable.put(Hashtable.java:459)
> at java.util.Properties.setProperty(Properties.java:166)
> at 
> org.apache.nifi.processors.mqtt.common.AbstractMQTTProcessor.transformSSLContextService(AbstractMQTTProcessor.java:292)
> at 
> org.apache.nifi.processors.mqtt.common.AbstractMQTTProcessor.onScheduled(AbstractMQTTProcessor.java:317)
> at 
> org.apache.nifi.processors.mqtt.ConsumeMQTT.onScheduled(ConsumeMQTT.java:222)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at 
> org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:142)
> at 
> org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:130)
> at 
> org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:75)
> at 
> org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:52)
> at 
> org.apache.nifi.controller.StandardProcessorNode.lambda$initiateStart$4(StandardProcessorNode.java:1526)
> at org.apache.nifi.engine.FlowEngine$3.call(FlowEngine.java:123)
> 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)
> 2020-09-28 21:51:00,669 ERROR [Timer-Driven Process Thread-1] 
> org.apache.nifi.util.ReflectionUtils Failed while invoking annotated method 
> 'public void 
> org.apache.nifi.processors.mqtt.ConsumeMQTT.onUnscheduled(org.apache.nifi.processor.ProcessContext)'
>  with arguments '[org.apache.nifi.processor.StandardProcessContext@64f9d3ca]'.
> java.lang.reflect.InvocationTargetException: null
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at 
> org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:142)
> at 
> org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:130)
> at 
> org.apache.nifi.util.ReflectionUtils.quietlyInvokeMethodsWithAnnotations(ReflectionUtils.java:268)
> at 
> org.apache.nifi.util.ReflectionUtils.quietlyInvokeMethodsWithAnnotation(ReflectionUtils.java:90)
> at 
> org.apache.nifi.controller.StandardProcessorNode.lambda$initiateStart$4(StandardProcessorNode.java:1569)
> at org.apache.nifi.engine.FlowEngine$3.call(FlowEngine.java:123)
> 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.processors.mqtt.common.AbstractMQTTProcessor.onStopped(AbstractMQTTProcessor.java:340)
> at 
> org.apache.nifi.processors.mqtt.ConsumeMQTT.onUnscheduled(ConsumeMQTT.java:238)
> ... 16 common frames omitted
>
> https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-mqtt-bundle/nifi-mqtt-processors/src/main/java/org/apache/nifi/processors/mqtt/common/AbstractMQTTProcessor.java#L289
>
> Jeremy

Reply via email to