Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jar run error #63

Closed
crnfan21 opened this issue Jul 30, 2024 · 6 comments
Closed

jar run error #63

crnfan21 opened this issue Jul 30, 2024 · 6 comments

Comments

@crnfan21
Copy link

crnfan21 commented Jul 30, 2024

Hi.

I tested build and run as indicated in the README, and it was successful.

But now, when I try to run the built jar directly through 'java -Djava.security.manager=allow -jar "C:\dev\maestro\maestro-server\build\libs\maestro-server.jar"', the following An error occurs. Could you please help?

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.lang.NoClassDefFoundError: ch/qos/logback/classic/spi/ThrowableProxy
        at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
        at ch.qos.logback.classic.Logger.log(Logger.java:765)
        at org.apache.commons.logging.LogAdapter$Slf4jLocationAwareLog.error(LogAdapter.java:440)
        at org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:818)
        at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:782)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289)
        at com.netflix.maestro.server.MaestroApp.main(MaestroApp.java:33)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        ... 5 more
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.spi.ThrowableProxy
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
        ... 17 more
@jun-he
Copy link
Contributor

jun-he commented Jul 30, 2024

@crnfan21 I think the built jar is not an uber jar packed with all dependencies so getting this class not found issue. Can you try ./gradlew bootRun to see if there is any issue?

@crnfan21
Copy link
Author

./gradlew bootRun runs well without any other issues and the API is called normally.

Also, I confirmed that the dependency is included in the jar.

Or maybe I did something wrong?

image

image (2)

image (3)

image (4)

@jun-he
Copy link
Contributor

jun-he commented Aug 1, 2024

@crnfan21 seems to be related to this issue: spring-projects/spring-boot#31853
Ctrl+c will lead another class not found error

^CException in thread "SpringApplicationShutdownHook" java.lang.NoClassDefFoundError: org/springframework/boot/availability/ReadinessState
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:172)
	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1032)
	at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.availability.ReadinessState
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)

@jun-he
Copy link
Contributor

jun-he commented Aug 1, 2024

Likely, we need to bump springboot to 3.x to solve it.

@crnfan21
Copy link
Author

crnfan21 commented Aug 2, 2024

It was confirmed that the jar was successfully executed in version 3.x. thanks!

@jun-he
Copy link
Contributor

jun-he commented Aug 2, 2024

Thanks @crnfan21 for the confirmation. I will link the issue to #8 and then close it.

@jun-he jun-he closed this as completed Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants