I raised a bug report at Jetbrains, see here: https://youtrack.jetbrains.com/issue/IDEA-380831/NoClassDefFoundError-org-slf4j-LoggerFactory-when-running-in-Intellij-but-works-fine-from-the-command-line and got the solution to the issue.
The solution was to disable the module path as shown in the screenshot below. Thank you @CrazyCoder for helping me out