0
votes

I am following the steps described in https://community.hortonworks.com/articles/90355/collect-data-from-opc-ua-protocol.html to connect to an OPC UA server from NiFi.

I built https://github.com/wadesalazar/NIFI-OPCUA from source code using Maven. The result was several nar files and jar files. The jar and nar obtained for me are:

opc-ua-stack-1.03.341.0-SNAPSHOT.jar

nifi-opcua-bundle-processors-0.0.1-SNAPSHOT.jar

nifi-opcua-service-0.0.1-SNAPSHOT.jar

nifi-opcua-service-api-0.0.1-SNAPSHOT.jar

opc-deploy-local-0.0.1-SNAPSHOT.jar

nifi-opcua-service-api-nar-0.0.1-SNAPSHOT.nar

nifi-opcua-service-nar-0.0.1-SNAPSHOT.nar

nifi-opcua-bundle-nar-0.0.1-SNAPSHOT.nar

If i paste all the nar and jar files in the lib folder of nifi , the nifi crashes when starting it. The error is:

org.apache.nifi.processor.Processor: Provider com.kentender.nifi.nifi_opcua_bundle.GetNodeIds could not be instantiated
java.util.ServiceConfigurationError: org.apache.nifi.processor.Processor: Provider com.kentender.nifi.nifi_opcua_bundle.GetNodeIds could not be instantiated
    at java.util.ServiceLoader.fail(ServiceLoader.java:232)
    at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at org.apache.nifi.nar.ExtensionManager.loadExtensions(ExtensionManager.java:138)
    at org.apache.nifi.nar.ExtensionManager.discoverExtensions(ExtensionManager.java:104)
    at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:699)
    at org.apache.nifi.NiFi.<init>(NiFi.java:160)
    at org.apache.nifi.NiFi.main(NiFi.java:267)
Caused by: java.lang.NoClassDefFoundError: org/apache/nifi/processor/util/StandardValidators
    at com.kentender.nifi.nifi_opcua_bundle.GetNodeIds.<clinit>(GetNodeIds.java:55)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
    ... 7 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.nifi.processor.util.StandardValidators
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 14 common frames omitted
2017-07-27 18:24:14,184 INFO [Thread-1] org.apache.nifi.NiFi Initiating shutdown of Jetty web server...
2017-07-27 18:24:14,184 INFO [Thread-1] org.apache.nifi.NiFi Jetty web server shutdown completed (nicely or otherwise).

If I paste only nar files, the Nifi boots up and i am able to see the custom GetNodeIds processor but i am unable to receive the data from OPCUA server. The service throws an error like

java.lang.noclassdeffounderror: org/bouncycastle/crypto/DataLengthException

Which nar and jar is to be copied to lib folder of NiFi so as to make it work and how is the process correct to proceed.

2

2 Answers

0
votes

quite sure that jar files you received after compile are included into nar files.

so you should copy only nar into lib dir.

but according to the following document upc-ua requires additional jars:

https://github.com/OPCFoundation/UA-Java#runtime-dependencies

just copy additional required libraries into lib folder.

0
votes

I have the same problem, I think that's because the class "StandardValidators" have been moved to nifi-utils-xxx.jar, you have to download it from maven repository as the jar file is not integrated in the NIFI installer.