My project uses handlebars-proto to bind templates to json. Also i am trying to use logstash-logback-encoder to log in form of Json for logstash. Below are my compile dependencies ( along with other dependencies)
compile 'net.logstash.logback:logstash-logback-encoder:4.6'
compile 'com.github.jknack:handlebars-proto:4.0.5'
If I remove handlebars dependency logging works fine. If handlebars is present I get the below warning :
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/manish/.gradle/caches/modules-2/files-2.1/com.github.jknack/handlebars-proto/4.0.5/5979737344d99e0d8b482e828f247ae86fd0113/handlebars-proto-4.0.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Users/manish/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.1.6/665e3de72f19ec66ac67d82612d7b8e6b3de3cd0/logback-classic-1.1.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
followed by error :
Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.NoSuchMethodError: ch.qos.logback.core.spi.ContextAwareBase.(Lch/qos/logback/core/spi/ContextAware;)V at net.logstash.logback.composite.CompositeJsonFormatter.(CompositeJsonFormatter.java:106) at net.logstash.logback.composite.loggingevent.LoggingEventCompositeJsonFormatter.(LoggingEventCompositeJsonFormatter.java:28) at net.logstash.logback.LogstashFormatter.(LogstashFormatter.java:122) at net.logstash.logback.LogstashFormatter.(LogstashFormatter.java:118) at net.logstash.logback.LogstashFormatter.(LogstashFormatter.java:114) at net.logstash.logback.encoder.LogstashEncoder.createFormatter(LogstashEncoder.java:31) at net.logstash.logback.encoder.CompositeJsonEncoder.(CompositeJsonEncoder.java:48) at net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder.(LoggingEventCompositeJsonEncoder.java:23) at net.logstash.logback.encoder.LogstashEncoder.(LogstashEncoder.java:27) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:379) at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.begin(NestedComplexPropertyIA.java:122) at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148) at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130) at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
I tried excluding slf4j as transitive dependency from handlebars but it did not help.
compile
('com.github.jknack:handlebars-proto:4.0.5'){
exclude module: 'slf4j-api'
}
Thanks in advance for help. Let me know if more details are required.