今天在学习springcloud时,学习到gateway访问外网,出现错误,报错内容为

[13c3884d] There was an unexpected error (type=Internal Server Error, status=500).

Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1475) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): |_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain] |_ checkpoint ⇢ HTTP GET "/guoji" [ExceptionHandlingWebHandler] Stack trace: at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1475) at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:552) at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:830) at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:798) at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:626) at io.netty.handler.ssl.SslHandler$SslEngineType$3.unwrap(SslHandler.java:280) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1332) at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1227) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1274) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:503) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:281) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:90) at sun.security.validator.Validator.getInstance(Validator.java:179) at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:312) at sun.security.ssl.X509TrustManagerImpl.checkTrustedInit(X509TrustManagerImpl.java:171) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:239) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:136) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1513) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:215) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1024) at sun.security.ssl.Handshaker$1.run(Handshaker.java:959) at sun.security.ssl.Handshaker$1.run(Handshaker.java:956) at java.security.AccessController.doPrivileged(Native Method) at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1415) at io.netty.handler.ssl.SslHandler.runAllDelegatedTasks(SslHandler.java:1502) at io.netty.handler.ssl.SslHandler.runDelegatedTasks(SslHandler.java:1516) at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1400) at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1227) at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1274) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:503) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:281) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:745) Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200) at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:120) at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:104) at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:88) ... 36 more

本人的源码如下

经过个人的测试和阅读资料,找到了问题的所在.

当想要代理的外网协议为https时,将会出现安全问题,当代理的外网协议为http时,变不会出现安全问题。

https为安全的协议,不能够随意的进行外网的代理。

Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must相关推荐

  1. 异常:java.security.InvalidAlgorithmParameterException the trustAnchors parameter must be non-empty解决方案

    异常:java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty解决方 ...

  2. java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

    网上解决办法大多是自定义X509TrustManager 来绕过认证 但是针对于使用别人封装好的sdk这种情况,还是要安装证书 我们去网站拷贝一份证书 我这里保存为 my.cer 参考:https:/ ...

  3. springcloud config配置中心 访问报错:java.security.InvalidAlgorithmParameterException: the trustAnchors param

    1. 报错信息 org.eclipse.jgit.api.errors.TransportException: https://github.com/fenggbinn/springcloud-con ...

  4. 使用Openjdk8和maven时出错:java.security.InvalidAlgorithmParameterException

    错误类型 Maven: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterExc ...

  5. pycharm激活错误提示:JetBrains Account connection error: java.security.Signatur...256 but was expecting 512

    报错: JetBrains Account connection error: java.security.SignatureException: Signature length not corre ...

  6. Java报错 the trustAnchors parameter must be non-empty

    错误原因:程序没有加载到认证文件. 项目情况: 对认证文件的声明填写在.properties配置文件中,因此也需要读取到properties. 操作: 我首先将.jks和.properties放在了t ...

  7. An unexpected error has been detected by Java Runtime Environment

    最近团队内部遇到一个非常奇怪的问题.网上有人说是sun公司的bug,我在这里贴一下,有兴趣的同志可以研究一下. 据说,换一个java版本就好了,团队内部正在进行升级java版本. sun公司官网解释: ...

  8. java dubbo 连接 zk 报错 Session 0x0 for server 127.0.0.1/<unresolved>:2181, unexpected error, closing so

    可能的解决方式 配置正常,zk 启动正常,但是就是连接不上 看下是否是你的项目使用 JDK 版本过高 我这里使用的是 17 ,调成 1.8 版本即可 问题概述 provider 配置如下 <be ...

  9. CDH5之Unexpected error.Unable to verify database connection

    在部署好CDH5(HDFS+MapReduce+Zookeeper)后,某一天想要通过web界面来添加Hive或者Oozie服务.  添加Hive组件服务: 1.报错:Unexpected error ...

最新文章

  1. RuntimeWarning:Glyph 21435 missing from current font.
  2. 怎么转换html格式文件怎么打开,html格式怎么转换
  3. Vijos1451圆环取数[环形DP|区间DP]
  4. Python爬虫==入门基础概念
  5. ***快速理解Docker - 容器级虚拟化解决方案
  6. max hit in personalization - CRM My Opportunity搜索的实现
  7. Linux kernel 中模块化的平台驱动代码介绍
  8. 林群院士:做科普也可以创新,和做科研一样
  9. Servlet技术详解
  10. LPDIRECTDRAW7编译错误的解决方法
  11. Dynamics AX2012 Menu Items Type
  12. java基础知识——JAVA中的函数(方法)
  13. 5G NR Type II CSI Codebook简介
  14. 听说你还在使用破解版Pycharm?
  15. android不root截图,某安卓手机无需root就可以被任意应用截屏及解决方案
  16. 华为的全闪存存储之路
  17. Mac Os Monterey brew apache启动后一致断续error
  18. 如何使用10个小时搭建出个人域名而又Geek的独立博客?
  19. 什么是 BeanDefinition?
  20. 学力银行产品负责人谈:未来企业培训管理五大趋势

热门文章

  1. Linux中alias永久更改命令别名
  2. typora:一些常用数学符号
  3. VSCode用Run code插件配置python环境(win10)
  4. Android单元测试技巧
  5. transition transform translate 之间的区别
  6. 二分思想(二分查找,整数二分,浮点数二分)
  7. stm32入门——定时器中断和中断优先级简介
  8. 欢迎到我们的学海灯塔给我们留言
  9. 自动化测试实施的前提条件
  10. DirectX9函数:Direct3DCreate9