I had a similar problem when using ShadowJar. What fixed it for me was adding the code below to my build.gradle
shadowJar { mergeServiceFiles() }