无法启动web服务器;嵌套异常为java.lang.IollegalArgumentException:无法解析密钥库



我正试图从命令行运行一个Spring Boot应用程序。我正在使用命令gradle bootRun来启动项目。项目成功生成。但是,应用程序无法正确启动。

预期:gradle bootRun应该构建项目并启动web应用程序。

实际:gradle bootRun成功构建项目,并产生以下错误

> Task :samples:ziti-spring-boot:bootRun FAILED
.   ____          _            __ _ _
/\ / ___'_ __ _ _(_)_ __  __ _    
( ( )___ | '_ | '_| | '_ / _` |    
\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::                (v2.6.1)
2021-12-28 14:26:37.431  INFO 9239 --- [           main] org.openziti.sample.springboot.Main      : Starting Main using Java 11.0.8 on Evans-MacBook-Pro-2.local with PID 9239 (/Users/evangertis/development/ziti-sdk-jvm/samples/ziti-spring-boot/build/classes/kotlin/main started by evangertis in /Users/evangertis/development/ziti-sdk-jvm/samples/ziti-spring-boot)
2021-12-28 14:26:37.433  INFO 9239 --- [           main] org.openziti.sample.springboot.Main      : The following profiles are active: development,native
2021-12-28 14:26:37.926  INFO 9239 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$548ad0aa] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-12-28 14:26:37.971  INFO 9239 --- [           main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2021-12-28 14:26:38.310  INFO 9239 --- [           main] ZitiImpl                                 : ZitiSDK version 0.23.12-dirty-SNAPSHOT @ffbf119(main)
2021-12-28 14:26:38.312  WARN 9239 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.IllegalArgumentException: Failed to parse keystore.  /Users/evangertis/development/ziti-sdk-jvm/samples/ziti-spring-boot does not exist or can not be read
2021-12-28 14:26:38.318  INFO 9239 --- [           main] ConditionEvaluationReportLoggingListener : 
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-12-28 14:26:38.334 ERROR 9239 --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.IllegalArgumentException: Failed to parse keystore.  /Users/evangertis/development/ziti-sdk-jvm/samples/ziti-spring-boot does not exist or can not be read
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.13.jar:5.3.13]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.1.jar:2.6.1]
at org.openziti.sample.springboot.Main.main(Main.kt:27) ~[main/:na]
Caused by: java.lang.IllegalArgumentException: Failed to parse keystore.  /Users/evangertis/development/ziti-sdk-jvm/samples/ziti-spring-boot does not exist or can not be read
at org.openziti.identity.UtilKt.loadKeystore(util.kt:82) ~[ziti-0.23.12-dirty-SNAPSHOT.jar:na]
at org.openziti.impl.ZitiImpl.loadContext$ziti(ZitiImpl.kt:75) ~[ziti-0.23.12-dirty-SNAPSHOT.jar:na]
at org.openziti.Ziti.newContext(Ziti.kt:55) ~[ziti-0.23.12-dirty-SNAPSHOT.jar:na]
at org.openziti.Ziti.newContext(Ziti.kt:64) ~[ziti-0.23.12-dirty-SNAPSHOT.jar:na]
at org.openziti.springboot.ZitiProtocolCustomizer.customize(ZitiProtocolCustomizer.kt:30) ~[ziti-springboot-0.23.12-dirty-SNAPSHOT.jar:na]
at org.openziti.springboot.ZitiProtocolCustomizer.customize(ZitiProtocolCustomizer.kt:26) ~[ziti-springboot-0.23.12-dirty-SNAPSHOT.jar:na]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.lambda$invokeProtocolHandlerCustomizers$1(TomcatServletWebServerFactory.java:354) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.util.LambdaSafe$Callbacks.lambda$null$0(LambdaSafe.java:287) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.util.LambdaSafe$LambdaSafeCallback.invoke(LambdaSafe.java:159) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.util.LambdaSafe$Callbacks.lambda$invoke$1(LambdaSafe.java:286) ~[spring-boot-2.6.1.jar:2.6.1]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.boot.util.LambdaSafe$Callbacks.invoke(LambdaSafe.java:286) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.invokeProtocolHandlerCustomizers(TomcatServletWebServerFactory.java:354) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeConnector(TomcatServletWebServerFactory.java:326) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:198) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) ~[spring-boot-2.6.1.jar:2.6.1]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ~[spring-boot-2.6.1.jar:2.6.1]
... 8 common frames omitted

该错误似乎与Unable to start web server; nested exception is java.lang.IllegalArgumentException: Failed to parse keystore有关。这可能与什么有关?

关于实际发生的事情的信息太少(没有上下文(。一些代码会很好。不过,在我看来,该应用程序正在寻找一个特定的keyStore文件,该文件不存在(或者其内容可能已损坏(。

请尝试创建keyStore或更正给定的路径。

它缺少一个导入语句:

import java.security.KeyStoreException;

最新更新