Documentation‎ > ‎

Frequently Asked Questions

Get answers to most commonly asked technical questions about ComfyJ. If you can’t find the answer here, please send us your question using the support forum, and we will add it to this FAQ after answering you.

Why is the "IllegalStateException: The ClassName object is null (not initialized)." exception thrown on attempt to invoke methods of the ClassName object?

This exception is thrown if a COM object was not initialized before its methods are invoked. A COM object is not initialized when there is no valid COM object that corresponds to its Java wrapper. COM objects are usually initialized by the appropriate CoClasses,ComFunctions.coCreateInstance() method or by other COM objects. For more details, please refer to ComfyJ Programmer's Guide.

A COM object method throws ComException with the error code like 0x800401f0. How can I get the error description?

ComfyJ provides messages for all standard HResult error codes. If ComException is thrown without any message, but with the error code, then this error is COM object specific and you should refer to the appropriate documentation for the error's details.

Is it necessary to call the .addRef() method of a COM object?

No, it is not. This method is called automatically when a COM object is created.

Is it necessary to release a COM object using the .release() method?

No, it is not. By default, this method is called automatically by ComfyJ.

What does the AutoDelete property of the IUknown class mean?

This property instructs ComfyJ's NativeResourceCollector whether to release the COM object automatically or not. By default, this property is set to true. When this property is set to false, the .release() method should be called.

How to query a necessary COM interface from a COM object?

A COM interface can be queried using the .queryInterface() method.

For example:
IOleObjectImpl oleObject = new IOleObjectImpl();
comObject.queryInterface(oleObject.getIID(), oleObject);
The alternative way is:
IOleObjectImpl oleObject = new IOleObjectImpl(comObject);

Does ComfyJ also work from an applet?

Yes, it does work from an applet.

Can I embed visual ActiveX Controls (OleContainer) into JInternalFrame?

OleContainer is a "heavyweight" component and the JInternalFrame is a "lightweight" one. It is not recommended to embed "heavyweight" components into "lightweight" ones.

See http://java.sun.com/products/jfc/tsc/articles/mixing/index.html for more information. It's better to use one of the "heavyweight" components instead of the JInternalFrame.

Why do I get the E_UNEXPECTED exception while trying to register an event handler for an ActiveX component?

If you use an inner class as an event handler, make sure it is static. In other case, please compare your code with the one from ComfyJ Programmer's Guide.

Why do I get the CONNECT_E_ADVISELIMIT exception while trying to register an event handler for an ActiveX component?

You need to register the event handler interface and the IDispatch interface in the instance of the IClassFactoryServer class with the registerInterface() method. Both the event handler interface and the IDispatch interface should be registered using a new IDispatchVTBL object like this:

IClassFactoryServer server = new IClassFactoryServer(MyEventHandler.class);
server.registerInterface(IDispatch.class, new IDispatchVTBL(server));
server.registerInterface(MyEventHandler.class, new IDispatchVTBL(server));