Module upgrade from 7 to 8: "Can't instantiate page using constructor"

This is a public service announcement for anyone that is upgrading a module to work with Ignition 8 and they have a gateway component with a settings page.

If you receive an Internal error when you navigate to your settings page, and the Ignition logs have this error:

jvm 1    | E [o.a.w.DefaultExceptionMapper  ] [20:05:24]: Unexpected error occurred
jvm 1    | org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.inductiveautomation.ignition.gateway.web.pages.Config(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument 'path=[seeq.hub]'. Might be it doesn't exist, may be it is not visible (public).

then you may need to change the following code:

Ignition 7.x-era constructor in your XxxxSettingsPage.java:

    public SeeqSettingsPage(final IConfigPage configPage) {
        super(configPage, null, new LenientResourceModel("Seeq.nav.settings.panelTitle"),
                ((GatewayContext) Application.get()).getPersistenceInterface().find(SeeqSettingsRecord.META, 0L));
    }

New Ignition 8.x-era constructor in your XxxxSettingsPage.java:

    public SeeqSettingsPage(final IConfigPage configPage) {
        super(configPage, null, new LenientResourceModel("Seeq.nav.settings.panelTitle"),
                ((IgnitionWebApp) Application.get()).getContext().getPersistenceInterface()
                        .find(SeeqSettingsRecord.META, 0L)
        );
    }

This was a needle in the haystack for me, hope it helps others!

3 Likes