Java HtmlUnit getPage()引发异常

Java HtmlUnit getPage()引发异常,java,htmlunit,htmlunit-driver,Java,Htmlunit,Htmlunit Driver,HtmlUnit的getPage()函数正在抛出javax.net.ssl.SSLException:无效的TLS填充数据和javax.net.ssl.SSLException:收到致命警报:坏记录\u mac不总是,但在两个三个请求之后,它开始抛出异常 URL使用HTTPS协议 你知道它有什么问题吗?如何解决 片段: 为多个请求调用网页会引发上述异常: public static WebClient getLoggedInHtmlUnit() { webClient = n

HtmlUnit的
getPage()
函数正在抛出
javax.net.ssl.SSLException:无效的TLS填充数据
javax.net.ssl.SSLException:收到致命警报:坏记录\u mac
不总是,但在两个三个请求之后,它开始抛出异常

URL使用
HTTPS
协议

你知道它有什么问题吗?如何解决

片段:

为多个请求调用网页会引发上述异常:

public static WebClient getLoggedInHtmlUnit() {


        webClient = new WebClient(BrowserVersion.FIREFOX_24);
        webClient.getOptions().setJavaScriptEnabled(true);
        webClient.getOptions().setCssEnabled(false); // I think this speeds the thing up
        webClient.getOptions().setRedirectEnabled(true);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
        webClient.getCookieManager().setCookiesEnabled(true);
        webClient.getOptions().setUseInsecureSSL(true);



        try {

            final HtmlPage page =  webClient.getPage(LOGIN_URL); //https://consyn.elsevier.com/user/login

            final HtmlForm form = page.getForms().get(0);  

            final HtmlTextInput textField =  form.getInputByName(USERNAME_BYINPUT_NAME);
            final HtmlPasswordInput pwd =  form.getInputByName(PASSWORD_BYINPUT_NAME);        
            textField.setValueAttribute(USERNAME);
            pwd.setValueAttribute(PASSWORD);   

            final HtmlSubmitInput button = (HtmlSubmitInput) form.getInputsByValue(LOGIN_BYVALUE).get(0);
            button.click();

            return webClient;

        } catch (FailingHttpStatusCodeException | IOException e) {
            e.printStackTrace();
            return null;
        }



}

我使用了下面的方法,效果很好,可以打印“页面加载…”。在Try-catch块内部使用此,而不是在外部使用此。我已经在Ubuntu Linux环境中使用jdk 6进行了尝试。如果失败,请检查MAC以外的其他操作系统。(我想你用的是MAC电脑)


错误是否仅发生在单个url或任何url上?你能给出一小部分代码来说明你的问题吗?不,在不同的URL上。。请参见编辑代码段。这有帮助吗?这很有魅力!
            WebClient webClient = new WebClient(BrowserVersion.FIREFOX_24);
            webClient.getOptions().setJavaScriptEnabled(false);
            webClient.getOptions().setUseInsecureSSL(true);
            HtmlPage page = (HtmlPage)     webClient.getPage("https://consyn.elsevier.com/user/login");
            System.out.println("Page Loaded ...");