关于更换SSL证书后,springboot项目启动报错ObjectIdentifier() -- data isn‘t an object ID (tag = 48)
前提:SSL证书一年一换,我是在阿里云上买的。按照以往的经验去更换
更换方法可查看之前的文章:https://www.cnblogs.com/wang-yaz/p/9414877.html
更换完成后,启动项目报错:
1 Caused by: ElasticsearchException[failed to initialize SSL TrustManager]; nested: IOException[parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48)]; nested: IOException[ObjectIdentifier() -- data isn't an object ID (tag = 48)]; 2 at org.elasticsearch.xpack.core.ssl.StoreTrustConfig.createTrustManager(StoreTrustConfig.java:75) 3 at org.elasticsearch.xpack.core.ssl.SSLService.createSslContext(SSLService.java:439) 4 at java.util.HashMap.computeIfAbsent(HashMap.java:1127) 5 at org.elasticsearch.xpack.core.ssl.SSLService.lambda$loadSSLConfigurations$5(SSLService.java:528) 6 ... 82 more 7 Caused by: java.io.IOException: parseAlgParameters failed: ObjectIdentifier() -- data isn't an object ID (tag = 48) 8 at sun.security.pkcs12.PKCS12KeyStore.parseAlgParameters(PKCS12KeyStore.java:816) 9 at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2018) 10 at java.security.KeyStore.load(KeyStore.java:1445) 11 at org.elasticsearch.xpack.core.ssl.TrustConfig.getStore(TrustConfig.java:98) 12 at org.elasticsearch.xpack.core.ssl.StoreTrustConfig.createTrustManager(StoreTrustConfig.java:66) 13 ... 85 more 14 Caused by: java.io.IOException: ObjectIdentifier() -- data isn't an object ID (tag = 48) 15 at sun.security.util.ObjectIdentifier.<init>(ObjectIdentifier.java:257) 16 at sun.security.util.DerInputStream.getOID(DerInputStream.java:314) 17 at com.sun.crypto.provider.PBES2Parameters.engineInit(PBES2Parameters.java:267) 18 at java.security.AlgorithmParameters.init(AlgorithmParameters.java:293) 19 at sun.security.pkcs12.PKCS12KeyStore.parseAlgParameters(PKCS12KeyStore.java:812) 20 ... 89 more
刚开始以为是密码错误,重新设置密码后,还是报错。
网上搜索了一下,有网友说是需要升级java版本,当前查看java版本是1.8.0-181, 尝试升级到1.8.0-381. 升级无果。
于是不用自己生成的pfx文件, 从阿里云SSL下载,我选择了服务器类型为Tomcat,证书格式为pfx进行下载。放置在代码中,重新启动项目,启动成功。
hello world!!!