AutomationException: 0x80029c4a - Error Loading Type Library/DLL in 'Invoke' |
|
This error can occur if the registry settings for the COM application you wish to access are somehow "out of synch" (this can happen for any number of reasons). Try reinstalling the COM application and run your application again. If you know the location of the type library for the COM application, you can also try reregistering it using the regtlb tool that comes in the jintegra\bin directory.
This error can also occur if the COM application's type library contains a type that is defined in a missing DLL (i.e. a DLL which was not included in the current installation/configuration). For example, say a COM component exposes two interfaces: IWork and IProblem.
- IWork has one method:
- meth1() which returns a pointer to an IProblem.
- IProblem has two methods and one property:
- methBad(): Method which takes a parameter of the undefined type
- methGood(): Method which takes no parameters
- title: String property
You will not be able to call IProblem->methBad() from Java or VB since the parameter is an undefined type. But the problem is that calling any method of the IProblem interface (via J-Integra in DCOM mode) gives the above exception.
However, there is a workaround for calling IProblem->methGood() and IProblem->getTitle(). The solution is to use late binding by following these two rules:
- Instead of creating an instance of the problematic object (IProblem in this case), create an instance of com.linar.jintegra.Dispatch.
- Instead of calling methods on the problematic object, use getPropertyByName() and invokeMethodByName().
Original Code
IProblem problemObj = IWork.meth1();
// Any method called on problemObj will fail
String title = problemObj.getTitle(); // fails!
Late Binding Version
com.linar.jintegra.Dispatch problemObj = new com.linar.jintegra.Dispatch(IWork.meth1());
// All methods may be called on problemObj except methBad()
Object[] params = {null};
problemObj.invokeMethodByName("methGood", params);
String title = (String) problemObj.getPropertyByName("title");