Jiwa 7.157 DLL logon error  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Jiwa 7.157 DLL logon error

Postby jeromeh » Wed Apr 13, 2016 9:47 am

We are getting the below error in our software using the DLLs after upgrading Jiwa 7 to 157.

Unhandled failure in LogOn! System.NullReferenceException: Object reference not set to an instance of an object.
at JiwaFinancials.Jiwa.JiwaApplication.Manager.HandleApplicationManagerPluginExceptions()
at JiwaFinancials.Jiwa.JiwaApplication.Manager.Logon(String ServerName, String DatabaseName, AuthenticationModes AuthenticationMode, String JiwaUserName, String JiwaPassword)

We have done a number of other Jiwa 7.0.157.0 upgrades without issue, and it doesn’t appear that anything has been done in this installation that is different from the others.

We are able to login to Jiwa client with the same details we are using in our software.

Given that this error is coming from when we attempt to log on, and it seems to be related to plugins somehow, are you able to give us any suggestions of likely causes to investigate?
jeromeh
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Wed Apr 08, 2009 9:53 am

Re: Jiwa 7.157 DLL logon error

Postby Mike.Sheen » Wed Apr 13, 2016 10:14 am

The exception you're getting is inside the "HandleApplicationManagerPluginExceptions" method of the JiwaApplication.Manager class.

This method looks like this:
Code: Select all
Public Sub HandleApplicationManagerPluginExceptions()

        For Each plugin As JiwaApplication.Plugin.Plugin In PluginCollection
            If Not plugin.Exception Is Nothing Then
                If plugin.ExceptionPolicy = JiwaApplication.Plugin.Plugin.ExceptionPolicies.Report Then
                    If Not MDIParentForm Is Nothing Then
                        ReportError(plugin.Exception.Message, "Plugin Name: " & plugin.Name)
                        plugin.Exception = Nothing
                    Else
                        Throw plugin.Exception
                    End If
                End If
            End If
        Next

    End Sub


It's simply iterating through the plugins to see if any had an exception on load/compilation so it can report it to the user, or throw it in the case of running outside Jiwa.exe. You're getting an NullReferenceException exception in there, so either the PluginCollection is somehow null (unlikely unless your code sets it to null), or one of the plugins is throwing a NullReferenceException.

You can confirm if it is a plugin by disabling all the plugins. Below is a script to disable all the plugins, storing away a record of which ones were enabled so they can be re-enabled later:

Code: Select all
-- Store away enabled plugins andd isable all plugins
CREATE TABLE EnabledPlugins
( RecID uniqueidentifier NOT NULL )
GO

INSERT INTO EnabledPlugins
SELECT RecID FROM SY_Plugin WHERE IsEnabled = 1
GO

UPDATE SY_Plugin SET IsEnabled = 0 WHERE IsEnabled = 1
GO


And to re-enable the previously disabled plugins:

Code: Select all
-- To Re-enable:
UPDATE SY_Plugin SET IsEnabled = 1
WHERE RecID IN (SELECT RecID FROM EnabledPlugins)
GO

DELETE FROM EnabledPlugins
GO



Try with all plugins disabled, if you still have the error then you will need to provide a code snippet showing me how you log on and what interactions you have with our classes before logon.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Jiwa 7.157 DLL logon error

Postby jeromeh » Wed Apr 13, 2016 1:43 pm

Hi Mike,

Thank you for that, I have confirmed that it was one of the custom plugins (which is odd that it did not seem to create errors using the Jiwa client).

To resolve the issue I simply created a new plugin and shifted all the custom fields from the old plugin to this new one (that is all the plugin was for). Not sure why this is the case, as the plugin did not have any of the issues outlined in the forum post for common issues for custom plugins.



Thanks.
jeromeh
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Wed Apr 08, 2009 9:53 am

Re: Jiwa 7.157 DLL logon error

Postby Mike.Sheen » Wed Apr 13, 2016 1:48 pm

jeromeh wrote:To resolve the issue I simply created a new plugin and shifted all the custom fields from the old plugin to this new one (that is all the plugin was for). Not sure why this is the case, as the plugin did not have any of the issues outlined in the forum post for common issues for custom plugins.


Ok, then it probably WAS that plugin throwing a null reference exception because of bad custom field / custom field values data.

I'd like to get hold of a copy of the database which exhibits the problem so I can work out what we can do to stop this happening again.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Jiwa 7.157 DLL logon error

Postby jeromeh » Wed Apr 13, 2016 2:59 pm

Hi Mike,

Think we spoke too soon, the error seems to have now returned even with out new plugin.

I will contact you via email about this, as we would like to discuss the specifics of this Jiwa database as it is the only one we seem to constantly have problems with.
jeromeh
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Wed Apr 08, 2009 9:53 am

Re: Jiwa 7.157 DLL logon error  Topic is solved

Postby Mike.Sheen » Tue Apr 26, 2016 3:01 pm

Hi Jerome,

We've got the database and have reproduced the issue.

To reproduce the issue, I created a new C# console application, referenced the JiwaApplication.DLL and JiwaODBC.DLL and added the following line of code:
Code: Select all
JiwaFinancials.Jiwa.JiwaApplication.Manager.Instance.Logon("SQLServerName", "DatabaseName", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "Admin", "password");           


When run, the exception occurred.

The cause is a custom plugin named "Warn on Exit" - it is attempting to reference the MDIParentForm property without first checking if it is null. This plugin seems to simply ask the user "Are you sure you wish to exit Jiwa?", and so is not really relevant to your use case.

The fix is to either disable that plugin (undesirable, as users using the Jiwa client probably want that message upon exit), or to make the following change to the plugin:

Change:
Code: Select all
Public Sub Setup(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaApplicationManagerPlugin.Setup
    AddHandler JiwaApplication.Manager.Instance.MDIParentForm.Load, AddressOf MainForm_Load
End Sub


To:

Code: Select all
Public Sub Setup(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaApplicationManagerPlugin.Setup
    If JiwaApplication.Manager.Instance.MDIParentForm IsNot Nothing Then
        AddHandler JiwaApplication.Manager.Instance.MDIParentForm.Load, AddressOf MainForm_Load
    End If
End Sub


Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests