NullPointerException when calling VisionClientInterface.getGuiUtil


I have below code in my module’s client hook:

public void startup(ClientContext context, LicenseState activationState) throws Exception {
super.startup(context, activationState);
VisionClientInterface vision = (VisionClientInterface)context.getModule(VisionClientInterface.VISION_MODULE_ID);

	if(vision != null)

When I install the module and start the client, I get following error
java.lang.NullPointerException: null
at com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl.getGuiUtil(
at com.vaspsolutions.mymodule.client.MyModuleClientHook.startup(
at com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl$LoadedModule.startup(
at com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl.startup(
at com.inductiveautomation.factorypmi.application.runtime.ClientPanel.startupApp(
at com.inductiveautomation.factorypmi.application.runtime.ClientPanel$LoginAction$
at Source)

Tried this with Ignition SDK versions 7.9.3, 7.9.4 and 7.9.5-SNAPSHOT
Ignition versions 7.9.5 and 7.9.7.

Is this an issue with API or am I missing something ?
getGUIUtil when called from VisionDesignerInterface in the designer hook works correctly.

Request to please help.

Based on the JavaDoc, I would guess that it is related to multiple desktop support, where the initial desktop hasn’t been established at module hook time. You might have to refactor your code to retrieve this interface when needed, respecting the possibility of different desktops, instead of assuming there’s only one instance.

1 Like

Thanks . After moving the code from client hook startup to the constructor of my vision component, the problem is solved.

1 Like