0

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

Ars
  • 591
  • 1
  • 4
  • 19

2 Answers2

0

Add slf4j.jar in your dependency or your project. Spring internally use slf4j for its own logging.

Killer
  • 592
  • 1
  • 6
  • 24
0

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.

Ars
  • 591
  • 1
  • 4
  • 19