欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

spring boot : Invalid Keystore format Error 解决方法

发布时间:2024/9/19 45 豆豆
生活随笔 收集整理的这篇文章主要介绍了 spring boot : Invalid Keystore format Error 解决方法 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

前言

  • springboot:2.0.0.RELEASE
  • maven
  • 开启HTTPS
  • 在eclipse中启动项目,可以正常启动
  • maven 打包后,启动springboot出现错误:Invalid Keystore format Error

异常原因

maven package 时修改了证书可文件。使用maven-resources-plugin插件copy resources时,filtering参数为true。符合条件的文件,会被maven进行修改(替换占位符。这个功能很有用,但是证书库不能被修改),导致错误。出错时的POM文件片段如下:

<plugin><artifactId>maven-resources-plugin</artifactId><executions><execution><id>copy-resources</id><phase>package</phase><goals><goal>copy-resources</goal></goals><configuration><resources><resource><directory>src/main/resources</directory><filtering>true</filtering></resource></resources></configuration></execution></executions> </plugin>

修改为如下,错误解决。

<plugin><artifactId>maven-resources-plugin</artifactId><executions><execution><id>copy-resources</id><phase>package</phase><goals><goal>copy-resources</goal></goals><configuration><resources><resource><directory>src/main/resources</directory><filtering>true</filtering><excludes><exclude>localhost.jks</exclude></excludes></resource><resource><directory>src/main/resources</directory><filtering>false</filtering><includes><include>localhost.jks</include></includes></resource></resources></configuration></execution></executions> </plugin>

总结

以上是生活随笔为你收集整理的spring boot : Invalid Keystore format Error 解决方法的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。