Dear all,
I have developed some custom modules and loaded them in a 8.0.7 gateway instance.
Every time the gateway service restarts, I get the following Module Manager Error in the gateway logs:
Module xyz failed to initialize script environment.
After that, I need to restart all the custom modules manually.
Where am I wrong? Are there some workarounds to avoid that behaviour?
Thanks a lot.
Andrea
One of the parameters your GatewayHook
class is passing to addScriptModule
is probably null
. obj
maybe?
Yeah, you are right!
The addScriptModule
method receives a null
object instance as input parameter, because that object (i.e. the “real” module class) is created in the startup
method of the GatweayHook
class, whereas the initializeScriptManager
is called before the startup phase.
Where is it better to create the obj
object? Maybe in the setup
(the class needs the gateway context in its constructor method)?
Best,
Andrea
initializeScriptManager
is called after setup
.
It’s common for these script objects to need the GatewayContext
, so you can store it in a field in your hook during the setup
call and then reference it during initializeScriptManager
or create the object during setup
instead.
1 Like
Thank you very much for your clarifications, Kevin!