Search code examples
springspring-mvcservletsthymeleaf

Adding javax.servlet-api dependency throws exception that org.slf4j.impl.StaticLoggerBinder faild to load but i don't use sl4j, i use thymeleaf


Basicaly title. I'm trying to run simple spring5 + thymeleaf project. If i don't add servlet-api i get an error that

cannot access javax.servlet.ServletException

But if i add servlet-api, project starts and works fine , but i get an error on startup:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation

But i don't use sl4j, i use thymeleaf. How does servlet exception connected with sl4j and how should i manage it?

UPD

I understand that my question is wrong. But i need help with connected problem: As someone suggested i added

<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>

But i still get Failed to load class "org.slf4j.impl.StaticLoggerBinder". exception. Any ideas?

UPD

as someone mentioned here this is a bug of ide


Solution

  • I'm using IntelIj idea. As someone sugested i added log4j and sl4j dependencies becouse servlet-api uses loging by default. And my exception that class is failed to load is just a bug of ide as it was mentioned in another question and everything including logging works fine.