DataPortal_Fetch method call failed - null reference.

DataPortal_Fetch method call failed - null reference.

Old forum URL: forums.lhotka.net/forums/t/995.aspx


garevalo posted on Wednesday, August 23, 2006

Hi,
I'm hoping I can get some useful tips to troubleshoot my install of CSLA 2.0.3 ProjectTracker Demo (trying to get the PTWeb to run).
I followed the setup instructions in the PDF. PTWin works fine. I know PTWeb uses EnterpriseServices and maybe that's where I missed something. I'm on CH4 almost at page 200 :P

So when I start the web app, it starts running ok until i click on project list, resource list, or project roles.

I get this page error:

==============================================<Page Error
Server Error in '/PTWebCs' Application.

Object reference not set to an instance of an object.

Line 20:     public static ProjectList GetProjectList()
Line 21:     {
Line 22:       return DataPortal.Fetch<ProjectList>(new Criteria());
Line 23:     }
Line 24:

Source File: C:\ProjectTrackerCSLA\ProjectTracker20cs\ProjectTracker.Library\ProjectList.cs    Line: 22

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]

[CallMethodException: DataPortal_Fetch method call failed]

[DataPortalException: DataPortal.Fetch failed]
   Csla.DataPortal.Fetch(Type objectType, Object criteria) in C:\Documents and Settings\G-\My Documents\Visual Studio 2005\Projects\ProjectTrackerCSLA\csla20cs\Csla\DataPortal\Client\DataPortal.cs:191
   Csla.DataPortal.Fetch(Object criteria) in C:\Documents and Settings\G-\My Documents\Visual Studio 2005\Projects\ProjectTrackerCSLA\csla20cs\Csla\DataPortal\Client\DataPortal.cs:138
   ProjectTracker.Library.ProjectList.GetProjectList() in C:\ProjectTrackerCSLA\ProjectTracker20cs\ProjectTracker.Library\ProjectList.cs:22
   ProjectList.GetProjectList() in c:\ProjectTrackerCSLA\ProjectTracker20cs\www\PTWeb\ProjectList.aspx.cs:88
   ProjectList.ProjectListDataSource_SelectObject(Object sender, SelectObjectArgs e) in c:\ProjectTrackerCSLA\ProjectTracker20cs\www\PTWeb\ProjectList.aspx.cs:77
   Csla.Web.CslaDataSource.OnSelectObject(SelectObjectArgs e) in C:\Documents and Settings\G-\My Documents\Visual Studio 2005\Projects\ProjectTrackerCSLA\csla20cs\Csla\Web\CslaDataSource.cs:123
   Csla.Web.CslaDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) in C:\Documents and Settings\G-\My Documents\Visual Studio 2005\Projects\ProjectTrackerCSLA\csla20cs\Csla\Web\CslaDataSourceView.cs:60
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +41
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

==================================================<END Page Error


VS2005 says:

An exception of type 'Csla.DataPortalException' occurred in Csla.DLL but was not handled in user code
Additional information: DataPortal.Fetch failed

and it breaks at line 191 in DataPortal.cs in the ProjectTracker.Library project.

I tweaked a couple of things to get up an running. Namely my dbconnection strings in all projects after attaching the databases to SQLEXPRESS 2005 and also the <pages> element to include parameter for enableSessionState="true" because that was the very first error i experienced upon fresh install and run.

thanks all, thanks Lhotka

G-

garevalo replied on Wednesday, August 23, 2006

i can get the local, webService, and remoting configs to run fine except for the EnterpriseServices. I regsvcs.exe the EnterpriseServicesHostCs.dll -
i'll bother with that config when i get to chapter 12, i guess, unless somebody can help me with the COM+ config. thanks

RockfordLhotka replied on Wednesday, August 23, 2006

There's more to it than just running regsvcs. You have to configure the COM+ application as well. This is discussed in Chapter 12, and isn't overly complex.

Copyright (c) Marimer LLC