gpt4 book ai didi

javax.net.ssl.SSLException : Invalid Padding length 异常

转载 作者:行者123 更新时间:2023-11-30 10:58:25 27 4
gpt4 key购买 nike

我在尝试通过 https 执行网络服务时遇到此异常。此异常发生在我尝试获取服务实例的 Action 中。我按照以下步骤使用 wsImport.exe 工具生成 Web 服务客户端。

  1. 我从网站手动下载了 wsdl

  2. 使用wsImport工具生成客户端java文件

  3. 将 java 文件添加到我在 eclipse 中的项目
  4. 编写如下测试客户端来测试服务实例

    public static void main(String[] args) {

    String certificatesTrustStorePath = "c:/Apps/Java/jdk1.8.0_25/jre/lib/security/cacerts";
    // if I don't set the store path, I get below error
    //javax.net.ssl.SSLHandshakeException:
    //sun.security.validator.ValidatorException: PKIX path building failed:
    //sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    System.setProperty("javax.net.ssl.trustStore", certificatesTrustStorePath);

    URL wsdlLocation = null;
    String https_url ="https://localhost/services/WebService/wsdl/WebService.wsdl";
    try {
    wsdlLocation = new URL(https_url);

    } catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    //This is the line where I get the below execption
    WebServiceService webServiceService = new WebServiceService(wsdlLocation,
    new QName("http://webservice.com", "WebServiceService"));

    }

使用上面的代码我执行以下操作

    Exception in thread "main" com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.

javax.net.ssl.SSLException: Invalid Padding length: 76
javax.net.ssl.SSLException: Invalid Padding length: 50

at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)
at com.webservice.WebServiceService.<init>(WebServiceService.java:42)
at com.client.Client.main(Client.java:46)

每次执行时,“Invalid Pad length”前面的数字都不一样。这次是 76 和 50。其他时候是 67、106。等等

请帮忙,我使用的是最新版本的 Java,即 1.8.0_51。

最佳答案

似乎类似于这个问题:https://community.oracle.com/thread/2506695

您尝试过使用 bouncycaSTLe 吗?

关于javax.net.ssl.SSLException : Invalid Padding length 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32266785/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com