Skip to content
Advertisement

Spring boot application won’t run when trying to run from the jar file

I have a spring boot application which works fine when run through intellij. But when I run it from the jar I am getting the below exception.

JavaScript

Below is my pom file.

JavaScript

I tried to create the jar by both

JavaScript

and

JavaScript

Then I run the jar by java -jar -DParamName=”someParam”

What am I doing wrong here? I am new to Spring. Any help would be much appreciated.

Advertisement

Answer

You have spring-boot-starter-jersey in your pom.xml. The error you are getting is /BOOT-INF/classes (No such file or directory). This is the issue with jersey which doesn’t work well with spring-boot fat jar. Please refer this and this for more details. For work around you have to package the classes that should be scanned by jersey in a jar and extract the jar as given at Spring-Boot documentation Extract specific libraries when an executable jar runs

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement