Error: java.lang.NoClassDefFoundError: Could not initialize class com.genRocket.engine.EngineManual

Caused By: java.lang.ExceptionInInitializerError

Caused By: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext



Reason: Spring boot includes spring-boot-starter-logging dependency by default, which conflicts with Genrocket's Log4j dependency

Solution: Add exclusion to both the spring-boot-starter and spring-boot-starter-web to resolve the conflict.


Example:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>