簡體   English   中英

無法啟動 web 服務器; 嵌套異常是 java.lang.IllegalArgumentException:無法解析密鑰庫

[英]Unable to start web server; nested exception is java.lang.IllegalArgumentException: Failed to parse keystore

我正在嘗試從命令行運行 Spring 引導應用程序。 我正在使用命令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 Unable to start web server; nested exception is java.lang.IllegalArgumentException: Failed to parse keystore 這可能與什么有關?

關於實際發生的事情的信息太少(沒有上下文)。 一些代碼會很好。 但在我看來,該應用程序正在尋找一個特定的 keyStore 文件,該文件不存在(或者它的內容可能已損壞)。

嘗試創建一個 keyStore 或更正給定的路徑。

它缺少一個導入語句:

import java.security.KeyStoreException;

運行配置可能有問題。 請重新檢查它們或在您的問題中添加您的運行配置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM