Object reference not set to an instance of an object.

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
6/28/2006 3:35:09 PM
Gravatar
Total Posts 4

Object reference not set to an instance of an object.

Hi

I've uploaded my mojo site to my ISP and now Im getting the error below.
This site works fine locallly.  It looks like the DLL's are not getting picked up..but they are in the bin directoy and the app has access to it (as far as I can tell).

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 1:  <%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="mojoPortal.Web.SiteHome" %>
Line 2: <%@ Register TagPrefix="portal" Namespace="mojoPortal.Web" Assembly="mojoPortal.Web" %>
Line 3: <portal:MasterPage id="MPContainer" runat="server">
Line 4: <portal:ContentRegion id="MPTitle" runat="server"></portal:ContentRegion>
Line 5: <portal:ContentRegion id="MPLeftPane" runat="server"></portal:ContentRegion>
6/28/2006 4:00:11 PM
Gravatar
Total Posts 18439

Re: Object reference not set to an instance of an object.

What version of mojoportal?
A release or did you compile it yourself?
Is this on Windows or Mono?
Which db are you using?
Did your host make the Data folder writable as it needs to be?
Are you sure your connection string is correct?
Did you get any errors creating the tableson the db at the host?
Does anything change if you restart the app?
6/28/2006 6:19:27 PM
Gravatar
Total Posts 4

Re: Object reference not set to an instance of an object.

Sorry, I should have been more specific in my initial email.

>>What version of mojoportal?
The latest .Net 1.1 version (I downloaded it yesterday)
y
>>A release or did you compile it yourself?
A release. I did not download the source.

>>Is this on Windows or Mono?
Windows

>>Which db are you using?
Sql Server. I'm not sure what version, but it is probably 6.5 or 7

>>Did your host make the Data folder writable as it needs to be?
When I look at the attributes using FTP, I can see that it is writeable for all, which I assume would include the asp.net user.

>>Are you sure your connection string is correct?
Yes, but I will check again to make sure.

>>Did you get any errors creating the tableson the db at the host?
Not when creating tables, but I did get permission issues on the stored procs.. see below..I will try and explain after all the questions.

>>Does anything change if you restart the app?
Not right now..but I did have some issues related to the question above. Let me explain what has happened:

The first time I ran the application I got the Object reference error. After editing the web.config (I just changed custom errors, so I could see what was going on) I got an error saying that I do not have execute rights on one of the stored procedures. I gave my user rights on it..applied..and then got the same error, but on a different SP. (This makes me think the conn-string is correct). I found that about half of the SP's had owner of DBO..and the other half had owner of my current user. Those SP's where the owner was my curr user had the correct execute permission. Those SP's that had the owner of DBO had *no* execute rights. I modifed all of the DBO SP's to have execute rights for my SQL user. (I did not change ownership).
After I refreshed, I was back at the Object reference error.
Since then, I have restarted it several times, but the errors stays the same.
6/28/2006 6:27:15 PM
Gravatar
Total Posts 18439

Re: Object reference not set to an instance of an object.

I suspect that some issues occurred in creating the default data. In Application_OnStart it will check the mp_Sites table and if no rows exist it will create the default data but the permissions errors probably prevented this from happening so maybe only partial data was created. I would try cleaning out all the tables then type a space in Web.config to re-start the app and see if things go better.

Hope it helps,

Joe
6/29/2006 6:42:42 AM
Gravatar
Total Posts 4

Re: Object reference not set to an instance of an object.

Joe,

I dropped all the tables and SP's and recreated them. Then granted permissions on all SP's.
Restarted...  and now I get this error:

@DefaultFriendlyUrlPattern is not a parameter for procedure mp_Sites_Insert.


Should the table have a default value, which is not working?

- Pieter
6/29/2006 6:55:12 AM
Gravatar
Total Posts 18439

Re: Object reference not set to an instance of an object.

Hmm, there seems to be a bug there but I'm very surprised it hasn't come up before. It did work on your local dev machine after all.

The bug is that the actual param in the stored proc is @DefaultFriendlyUrlPatternEnum not @DefaultFriendlyUrlPattern

I think if you rename it in the proc to @DefaultFriendlyUrlPattern that will fix it for you but you may need to clean out the data again.

Probably this bug only happens if you have <add key="CachePostgreSQLParameters" value="False" /> in your web.config. If its set to true then params are not declared by name, the are retrieved from the db so the name is always correct. Also should get better performance with it set to true.

So either set that to true or modify the proc to fix the name and it will probably fix things, though you may need to clean out the data again.

As a side note I should mention that we are planning to release version 2.1 which has a lot of new features this weekend. If you are still having issues by then with 2.0.1 maybe you will have better luck with the new version.

Hope it helps,

Joe
6/29/2006 6:56:06 AM
Gravatar
Total Posts 18439

Re: Object reference not set to an instance of an object.

Er, I meant <add key="CacheMSSQLParameters" value="False" />, accidently copied the pgsql one
6/29/2006 7:04:24 AM
Gravatar
Total Posts 18439

Re: Object reference not set to an instance of an object.

Oh. disregard about the new release. I forgot you are using 1.1 framework. The 2.1 version is only for the 2.0 .NET framework.
6/29/2006 7:19:01 AM
Gravatar
Total Posts 4

Re: Object reference not set to an instance of an object.

That worked :)
But read on: <grin>

I edited the SP, and renamed the param. cleared the table and restarted.
Then I got the following error:

Procedure 'mp_Sites_Insert' expects parameter '@AllowPageSkins', which was not supplied.


So, I went  ahead and did the web.config change you suggested, which fixed the problem.

Thanks for your help - very much appreciated.
Pieter
6/29/2006 4:51:06 PM
Gravatar
Total Posts 18439

Re: Object reference not set to an instance of an object.

Excellent! Glad your site is up and running. I am a little surpised that if you are using Windows hosting, you are not using the 2.x version of mojoPortal under 2.0 .NET. The 2.x version is under active development while the 1.x branch is under maintentance only.

In any case, a new release is coming this weekend for both branches. There will be a 1.0.2 release that has a number of bug fixes including fixes for the issues you saw. The 1.0.2 release will also have the newest version of FCKeditor. It will be an easy upgrade since there are no changes to the db tables. You will want to run the script for stored procedures to get the latest version of them.

If your host offers 2.0 .NET, there are a lot of new features coming in the 2.1 release I'll blog about soon.

Cheers,

Joe
You must sign in to post in the forums. This thread is closed to new posts.