I have a spring boot application with gradle which uses following dependency
compile('org.springframework.boot:spring-boot-starter-data-jpa')
This dependency includes javassist-3.21.0-GA.jar in the library.
When I run the application in STS IDE using run as springboot application, everything works fine.
But when I run the spring boot jar of application using command
java -jar <application-jar>
then javassist throws following exception
javassist.NotFoundException: <class name>
By default, Javassist only looks up classes from the class path. But Spring Boot uses its own class loader hierarchy when bundling it in a self-executable. You need to register this class loader manually for this reason. Have a look at ClassPool#appendClassPath on how to include additional class path elements. You require to include your classes ClassLoader in a LoaderClassPath.