This discussion is archived
4 Replies Latest reply: Feb 15, 2011 1:48 PM by 837338 RSS

Catastrophic error when calling an OCX from Jacob

814681 Newbie
Currently Being Moderated
Hello,

I am calling a 3rd party OCX (ActiveX component) from Java via Jacob (http://sourceforge.net/projects/jacob-project/).

I have identified the name of the component in the registry on the machine (it was registered as part of the installation of the 3rd party software) and am referring to it using this name within my Java program.

I use com.jacob.activeX.ActiveXComponent.invoke to call one of a number of different functions on the component, using Variants as parameters:
public class MyClass {
    private static String ACTIVEX_COMPONENT = "<ActiveX component name>";

    public static void main(String[] args) {
         try {
              System.setProperty("jacob.dll.path", "C:\\temp\\Eclipse\\Workspaces\\jasmine6.2\\lib\\jacob-1.15-M2-x86.dll");
              ActiveXComponent control = new ActiveXComponent(ACTIVEX_COMPONENT);
          Dispatch dispatch = control.getObject();
          Variant result = new Variant(new Float(0.0f), true);
          Dispatch.call(dispatch, "<Function name>", result);
          System.out.println(result);
         } catch (Throwable throwable) {
              throwable.printStackTrace();
         }
    }
}
Whichever function I try and call, I get the following error: "A COM exception has been encountered at invoke of <Method name>: Catastrophic Failure":
com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: GetVersion
Description: Catastrophic failure
     at com.jacob.com.Dispatch.invokev(Native Method)
     at com.jacob.com.Dispatch.invokev(Dispatch.java:858)
     at com.jacob.com.Dispatch.callN(Dispatch.java:455)
     at com.jacob.com.Dispatch.call(Dispatch.java:544)
     at comrad.MyClass.main(MyClass.java:19)
The ActiveX component has a logger, which is appended when the Java program runs, so I know that the component definition is correct.

I have raised this upon the Jacob support forum but have yet to receive any response. Similarly, I can find other examples of the same error on the Net but can't find any solutions.

Any advice as to a remedy would be greatly appreciated: thanks.
  • 1. Re: Catastrophic error when calling an OCX from Jacob
    837338 Newbie
    Currently Being Moderated
    Are you having trouble with ActiveX controls? To fix activex controls, try opening your browser window to uninstall the problem ActiveX control and install it again later. Click Tools, choose Manage Add-Ons and Enable/Disable Add-Ons. Choose Downloaded ActiveX Controls from the drop-down list and choose the ActiveX control you want to delete. Highlight and delete it, and then click OK. Go to the website wherein you got your ActiveX control and correctly reinstall the ActiveX control.
  • 2. Re: Catastrophic error when calling an OCX from Jacob
    814681 Newbie
    Currently Being Moderated
    Thanks for the thoughts.

    The OCX wasn't acquired from a website - it's a 3rd party component that was supplied upon a CD.

    I have already tried unregistering the OCX via the Windows command prompt and re-registering it using regsrv32. When I try and call the OCX subsequently, I get the same error message,
  • 3. Re: Catastrophic error when calling an OCX from Jacob
    814681 Newbie
    Currently Being Moderated
    The issue was with the ActiveX component. There's an MSDN article explaining the issue here: http://support.microsoft.com/kb/189065.

    The 3rd party implemented the change as described and the new version of the component works as expected.
  • 4. Re: Catastrophic error when calling an OCX from Jacob
    837338 Newbie
    Currently Being Moderated
    Have you fixed your ActiveX controls yet? To fix them, click Tools, choose Manage Add-Ons, and Enable/Disable Add-Ons. Select Download ActiveX Controls and highlight the control that you want to delete. Click OK to delete it and go to the website where you got your ActiveX control and reinstall it correctly. http://activexfix.org/what-are-activex-controls.html

    Edited by: 834335 on Feb 15, 2011 1:48 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points