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

Improve message when spring-boot application is not found #44

Open
jbonofre opened this issue Jan 18, 2023 · 0 comments
Open

Improve message when spring-boot application is not found #44

jbonofre opened this issue Jan 18, 2023 · 0 comments
Assignees
Milestone

Comments

@jbonofre
Copy link
Member

With the minho-spring-boot application manager, the user can load several spring-boot application via the ConfigService#Applications. For instance, he can define spring-boot applications via minho.json file:

{
  "applications": [
    {
      "name": "one-app",
      "type": "spring-boot",
      "url": "file:./app/my-spring-boot-app-1.0-SNAPSHOT.jar",
      "properties": {
        "args": "--server.port=8181"
      }
    }
  ]
}

If the minho-spring-boot application manager doesn't find the jar on the provided url, the user get this error:

INFO: Starting Spring Boot module file:./app/my-spring-boot-app-1.0-SNAPSHOT.jar
Exception in thread "main" java.lang.IllegalStateException: Can't start lifecycle service
        at org.apache.karaf.minho.boot.service.LifeCycleService.start(LifeCycleService.java:66)
        at org.apache.karaf.minho.boot.service.ServiceRegistry.lambda$start$2(ServiceRegistry.java:128)
        at java.base/java.util.Optional.ifPresent(Optional.java:178)
        at org.apache.karaf.minho.boot.service.ServiceRegistry.start(ServiceRegistry.java:126)
        at org.apache.karaf.minho.boot.Minho.start(Minho.java:59)
        at org.apache.karaf.minho.boot.Main.main(Main.java:63)
        Suppressed: java.lang.RuntimeException: Can't start Spring Boot module file:./app/my-spring-boot-app-1.0-SNAPSHOT.jar
                at org.apache.karaf.minho.springboot.SpringBootApplicationManagerService.lambda$onRegister$0(SpringBootApplicationManagerService.java:57)
                at java.base/java.lang.Iterable.forEach(Iterable.java:75)
                at org.apache.karaf.minho.springboot.SpringBootApplicationManagerService.lambda$onRegister$1(SpringBootApplicationManagerService.java:53)
                at org.apache.karaf.minho.boot.service.LifeCycleService.lambda$start$0(LifeCycleService.java:69)
                at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
                at org.apache.karaf.minho.boot.service.LifeCycleService.start(LifeCycleService.java:67)
                ... 5 more
        Caused by: java.lang.ClassNotFoundException: org.springframework.boot.loader.JarLauncher
                at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
                at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
                at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
                at org.apache.karaf.minho.springboot.SpringBootApplicationManagerService.start(SpringBootApplicationManagerService.java:106)
                at org.apache.karaf.minho.springboot.SpringBootApplicationManagerService.lambda$onRegister$0(SpringBootApplicationManagerService.java:55)
                ... 10 more

It could be confusing as the problem is not really ClassNotFoundException: org.springframework.boot.loader.JarLauncher but actually the application jar file is not found.

The minho-spring-boot application manager should first check if the jar exists on the provided URL and throw a clean message if not.

@jbonofre jbonofre added this to the 0.2 milestone Jan 18, 2023
@jbonofre jbonofre self-assigned this Jan 18, 2023
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

1 participant