1

I have application developed in spring boot (v 1.5.9.RELEASE) which is working with tomcat v 7.0

I need to upgrade to new version of tomcat v 8.5. I have installed it ( apache-tomcat-8.5.32) and tried to deploy the same app. But I am getting exception while deployment of app.

Exception is with slf4j and log4j multiple bindings. I have started development of my app with Spring Initializr tool (https://start.spring.io/)

How can I fix this issue? As I am not aware of which specific dependency causing this issue and where do I need to add exclusion. Please help with this.

  • 1
    Are you not using Spring Boot's own Tomcat instance? Are you converting to a .war file and then deploying to Tomcat in the traditional sense? – HomerPlata Aug 10 '18 at 10:29
  • Agree with @HomerPlata, you can just use the embedded server https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-web-servers.html. – Max Farsikov Aug 10 '18 at 10:32
  • You didn't show us your code nor error you are getting. Sorry but in such case it is impossible to help you. – luboskrnac Aug 10 '18 at 11:37
  • Sorry for incomplete post. Here is error which I am getting: Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details. at org.slf4j.impl.Log4jLoggerFactory.(Log4jLoggerFactory.java:54) – Santosh Giri Aug 10 '18 at 11:53

1 Answers1

1

Well, AFAIK Spring Boot uses Logback by default rather than SLF4J. So I suspect that's where the multiple bindings issue comes from (documentation).

Your logging should contain a message mentioning what bindings clash, you can use mvn dependency:tree to figure out where it comes from. Also see this and this answer.

RikH
  • 151
  • 1
  • 8