Here's a full example of what I see when I run a unit test. In my root /pom.xml/, I'm forcing a dependency of /slf4j-api/ and /slf4-simple/, version 1.7.25, to ensure what's there isn't something old offered by another dependency. Any suggestion would be welcome.

*java.lang.AssertionError: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;*

at org.apache.nifi.util.StandardProcessorTestRunner.run(StandardProcessorTestRunner.java:193) at org.apache.nifi.util.StandardProcessorTestRunner.run(StandardProcessorTestRunner.java:152) at org.apache.nifi.util.StandardProcessorTestRunner.run(StandardProcessorTestRunner.java:147) at org.apache.nifi.util.StandardProcessorTestRunner.run(StandardProcessorTestRunner.java:142) at com.imatsolutions.nifi.processor.SlaTimerTest.testStopTimestampWarnAndPass(SlaTimerTest.java:114)
    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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) *Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;*
    at org.apache.nifi.util.CapturingLogger.warn(CapturingLogger.java:304)
    at org.apache.nifi.util.CapturingLogger.warn(CapturingLogger.java:299)
    at org.apache.nifi.util.CapturingLogger.warn(CapturingLogger.java:294)
at org.apache.nifi.util.MockComponentLog.warn(MockComponentLog.java:137) at com.imatsolutions.nifi.processor.SlaTimer.onTrigger(SlaTimer.java:109) at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) at org.apache.nifi.util.StandardProcessorTestRunner$RunProcessor.call(StandardProcessorTestRunner.java:243) at org.apache.nifi.util.StandardProcessorTestRunner$RunProcessor.call(StandardProcessorTestRunner.java:237)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)





On 04/06/2017 12:28 PM, Russell Bateman wrote:
I'm struggling to figure out how to respond to this problem of ensuring the presence of MessageFormatter(), which I think is in /slf4j-simple-x.y.z.jar/, and/or ensuring the log4j system is properly initialized. The need for slf4j is clearly coming from NiFi; I only need it because it's a dependency in NiFi. I know there are problems with slf4j version mixtures and I'm trying not to do anything else but allow NiFi to cause the right version to get pulled in.

When I run some of my unit tests, I'm seeing this:


log4j:WARN No appenders could be found for logger (com.imatsolutions.nifi.processor.filter.LegacyFullDocSearchReplaceFilter).
log4j:WARN Please initialize the log4j system properly.

java.lang.AssertionError: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;

at org.apache.nifi.util.StandardProcessorTestRunner.run(StandardProcessorTestRunner.java:192)
.
.
.
Caused by: java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
    at org.apache.nifi.util.CapturingLogger.warn(CapturingLogger.java:304)
.
.
.

Suggestions? Rules of thumb?

Thanks.


Reply via email to