后续通过搜索查到添加:System.out.println(Arrays.toString(Security.getProviders())); 发现 Linux 环境缺少了 SunEC version 1.8 加密包
本地 Mac:[SUN version 1.8, SunRsaSign version 1.8, SunEC version 1.8, SunJSSE version 1.8, SunJCE version 1.8, SunJGSS version 1.8, SunSASL version 1.8, XMLDSig version 1.8, SunPCSC version 1.8, Apple version 1.8]
测试 Linux:[SUN version 1.8, SunRsaSign version 1.8, SunJSSE version 1.8, SunJGSS version 1.8, SunSASL version 1.8, XMLDSig version 1.8, SunPCSC version 1.8]
抛出异常,还是找不到 jar 包 com.sun.crypto.provider.SunJCE() 2022-04-19 17:16:09,144 \[// - - -\] ERROR com.alibaba.dubbo.rpc.filter.ExceptionFilter - \[DUBBO\] Got unchecked and undeclared exception which called by xxx.xxx.xxx.xxx. service: com.xxx.xxx, method: xxx, exception: Java.lang.NoClassDefFoundError: com/sun/crypto/provider/SunJCE, dubbo version: x.x.x, current host: xxx.xxx.xxx.xxx Java.lang.NoClassDefFoundError: com/sun/crypto/provider/SunJCE
Linux 下载 JDK 查对应包,是存在的 \$JAVA_HOME/jre/lib The 4 jar packages in the / directory are as follows: jce.jar security/US_export_policy.jar security/local_policy.jar ext/sunjce_provider.jar