I'm looking to run an exploded spring-boot jar. Currently I'm doing
jar xf app.jar
java -cp /lib/*:/ com/domain/module/Main
which seems to begin the app startup, but invariably stops on
[restartedMain] INFO c.a.a.spring.MetricsJersey2Config - Registering InstrumentedResourceMethodApplicationListener for jersey2 with MetricRegistry: com.codahale.metrics.MetricRegistry@43fee23e
The next line I'd usually expect to see is
[restartedMain] INFO o.s.s.c.ThreadPoolTaskExecutor - Initializing ExecutorService
Running the app using
java -jar app.jar
works fine, but for reasons I need to run it exploded.
Is there anything I'm missing in trying to run a spring-boot app this way?
To be able to run your Spring Boot app, you will need to first build it. To build and package a Spring Boot app into a single executable Jar file with a Maven, use the below command. You will need to run it from the project folder containing the pom. xml file.
To run an application in a nonexecutable JAR file, we have to use -cp option instead of -jar. We'll use the -cp option (short for classpath) to specify the JAR file that contains the class file we want to execute: java -cp jar-file-name main-class-name [args …]
I solved this by running:
java -cp /lib/*:/ com.domain.module.Main
Rather than:
java -cp /lib/*:/ com/domain/module/Main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With