# NullPointerException when calling VisionClientInterface.getGuiUtil

**URL:** <https://forum.inductiveautomation.com/t/nullpointerexception-when-calling-visionclientinterface-getguiutil/17698>\
**Category:** Module Development\
**Tags:** sdk, ignition79\
**Created:** [April 13, 2018, 6:38am UTC](https://forum.inductiveautomation.com/t/nullpointerexception-when-calling-visionclientinterface-getguiutil/17698 "2018-04-13T06:38:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yogini\_Marathe](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@Yogini\_Marathe](https://forum.inductiveautomation.com/u/Yogini_Marathe)\
**Post date:** [April 13, 2018, 6:38am UTC](https://forum.inductiveautomation.com/t/nullpointerexception-when-calling-visionclientinterface-getguiutil/17698/1 "2018-04-13T06:38:41Z")

</div>

Hi,

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)
	{
		vision.getGuiUtil();
	}
}

```

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(ClientContextImpl.java:438)  
at com.vaspsolutions.mymodule.client.MyModuleClientHook.startup(MyModuleClientHook.java:30)  
at com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl$LoadedModule.startup(ClientContextImpl.java:328)  
at com.inductiveautomation.factorypmi.application.runtime.ClientContextImpl.startup(ClientContextImpl.java:373)  
at com.inductiveautomation.factorypmi.application.runtime.ClientPanel.startupApp(ClientPanel.java:710)  
at com.inductiveautomation.factorypmi.application.runtime.ClientPanel$LoginAction$LoginTask.run(ClientPanel.java:547)  
at java.lang.Thread.run(Unknown 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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 13, 2018, 12:05pm UTC](https://forum.inductiveautomation.com/t/nullpointerexception-when-calling-visionclientinterface-getguiutil/17698/2 "2018-04-13T12:05:45Z")

</div>

[Based on the JavaDoc](http://files.inductiveautomation.com/sdk/javadoc/ignition79/793/index.html), 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.

---

<div class="post-metadata">

**Author:** ![Yogini\_Marathe](https://avatars.discourse-cdn.com/v4/letter/y/85e7bf/32.png) [@Yogini\_Marathe](https://forum.inductiveautomation.com/u/Yogini_Marathe)\
**Post date:** [April 14, 2018, 6:53am UTC](https://forum.inductiveautomation.com/t/nullpointerexception-when-calling-visionclientinterface-getguiutil/17698/3 "2018-04-14T06:53:34Z")

</div>

> [@pturmel](#):
>
> ng there's only one instance.

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