Hi Donald,

I know this does not directly address the conflict in dependencies, but I
wanted to mention that it is not required to inherit from nifi-nar-bundles.

The Maven archetype does that by default, but you can certainly remove it,
there are some instructions on how to do so here:
https://cwiki.apache.org/confluence/display/NIFI/Maven+Projects+for+Extensions#MavenProjectsforExtensions-Inheritance

Once you add the build section with the NAR plugin, then you can go back to
<packaging>nar</packaging>.

-Bryan

On Mon, Jun 13, 2016 at 10:12 AM, Dr. Donald Leonhard-MacDonald <
[email protected]> wrote:

> Hi Oleg,
>
> Thank you for your quick response. Unfortunately it’s still not working.
>
> I had tried these but had left them out by mistake when I’d tried mutation
> coding to get it all running. :-)
>
> I have added them in now so it can be tested. I’m still getting the same
> error.
>
> java.lang.reflect.InvocationTargetException
> 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:497)
> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
> at NifiLogging.processors.LoggingProcessor.App.main(App.java:12)
> ... 6 more
> Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 7 more
>
>
> I think it’s a problem with a conflict in
>
> <parent>
>         <groupId>org.apache.nifi</groupId>
>         <artifactId>nifi-nar-bundles</artifactId>
>         <version>0.6.1</version>
>         <relativePath></relativePath>
> </parent>
>
> When I remove it and change
>
>     <artifactId>nifi-LoggingProcessor-nar</artifactId>
>     <version>1.0</version>
>     <packaging>nar</packaging>
>
> To
>
>     <artifactId>nifi-LoggingProcessor-nar</artifactId>
>     <version>1.0</version>
>     <packaging>jar</packaging>
>
> it works.
>
> Any ideas?
>
> Cheers,
>
> Donald
>
> On 13 Jun 2016, at 14:01, Oleg Zhurakousky <[email protected]>
> wrote:
>
> Donald
>
> What I see is that SLF4J is nowhere in your claspath, so by adding it to
> your pom should solve the issue. Also don’t forget to add specific bindings
> (e.g., log4j) and its implementation.
> Basically here is the example of what you need to have if you want to use
> Log4j:
>
> <dependency>
>     <groupId>org.slf4j</groupId>
>     <artifactId>slf4j-api</artifactId>
>     <version>1.7.21</version>
> </dependency>
> <dependency>
>     <groupId>org.slf4j</groupId>
>     <artifactId>slf4j-log4j12</artifactId>
>     <version>1.7.21</version>
> </dependency>
> <dependency>
>     <groupId>log4j</groupId>
>     <artifactId>log4j</artifactId>
>     <version>1.2.17</version>
> </dependency>
>
> Cheers
> Oleg
>
> On Jun 13, 2016, at 7:22 AM, Dr. Donald Leonhard-MacDonald <
> [email protected]> wrote:
>
> Hi All,
>
> First let me say I’m really enjoying using Nifi, it’s a great project.
>
> I have been creating some Processors and they are working very well. Now I
> want to include processors that talk to RethinkDB.
> When I include the dependency in Maven I get an
> java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory Exception.
>
> I have been using the getLogger in the processors and that works really
> well.
>
> I thought it might be a versioning issue(as suggested on website), so
> tried different versions but with no success. Though I can
> use the log4j when I restrict the scope of the jar to test.
>
> So I created several small test frameworks that only imported Log4J and
> nothing else to try and see what I was doing wrong.
> As soon as I set the parent of my pom to nifi
>
> Here is a very small example that creates the error
>
> https://github.com/macd-ci0/nifilogging
>
> mvn compile
> mvn exec:java
>
> A
> [WARNING]
> java.lang.reflect.InvocationTargetException
> 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:497)
> at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
> at NifiLogging.processors.LoggingProcessor.App.main(App.java:12)
> ... 6 more
> Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 7 more
>
>
> When I remove the parent element:
> <parent>
>         <groupId>NifiExcel</groupId>
>         <artifactId>ExcelProcessors</artifactId>
>         <version>1.0</version>
> </parent>
> and change the target type from nar->jar in the pom.xml file in the -nar
> directory It works well.
> So the conflict is here.
>
> I get the same conflict. When I tried to create a copy similar to the pom
> for the nifi-kafka-bundle/nifi-kafka-processors which
> also uses Log4J,  I get the same problem.
>
> I have also tried logback, etc..
>
> Any ideas what I am doing wrong. What should I be doing differently?
>
> I looked at the mailing list, FAQ and such and I cannot see what I am
> doing incorrectly.
>
> Spinning in circles and hoping for help. :-)
>
>
> Donald
>
>
>
>

Reply via email to