htmlunit Active Load异常

时间:2017-06-01 08:56:13

标签: java htmlunit jacob

public static void main(String[] args) throws
FailingHttpStatusCodeException, MalformedURLException,IOException,
InterruptedException {

    final ActiveXComponent activeXComponent = new ActiveXComponent("CLSID:0CA54D3F-CEAE-48AF-9A2B-31909CB9515D");

    WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER);
    webClient.getOptions().setThrowExceptionOnScriptError(false);
    webClient.getOptions().setActiveXNative(true);
    // https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/Login.aspx
    HtmlPage page = webClient.getPage("https://pbsz.ebank.cmbchina.com/CmbBank_GenShell/UI/GenShellPC/Login/LoginOLD.aspx");
    System.out.println(page.asXml()); }

enter image description here

  

线程“main”中的异常com.jacob.com.ComFailException:找不到名字对象

我通过了C:\Windows\System32\CMBEdit.dll Still not feasible

1 个答案:

答案 0 :(得分:0)

<强>更新

这是Jacob的问题,因为例外是:

Exception in thread "main" com.jacob.com.ComFailException: Can't find moniker
    at com.jacob.com.Dispatch.createInstanceNative(Native Method)
    at com.jacob.com.Dispatch.<init>(Dispatch.java:99)
    at com.jacob.activeX.ActiveXComponent.<init>(ActiveXComponent.java:58)
    at test.test.JacobTest.main(JacobTest.java:24)

正如另一个answer暗示的那样:

  

必须注册才能找到COM对象。无所谓   他们居住的文件夹。

     

呼叫

regsvr32 mycomdll.dll
     

在dll上。