Register   Login
     
  Latest Posts  
Catcha doesnt seem to work
by chaloum on 3/20/2010 8:16 PM
RE: Recently created articles are not shown in list
by atriage on 3/20/2010 10:15 AM
RE: Recently created articles are not shown in list
by spirit on 3/20/2010 10:08 AM
RE: Introducing the most powerful News Slider for Ventrian News Articles
by jhoelz on 3/19/2010 9:29 PM
Rich Snippets for Review, Ratings etc!
by georgelew on 3/19/2010 7:49 PM
Recently created articles are not shown in list
by atriage on 3/19/2010 11:18 AM
RE: News Articles Tokens
by spirit on 3/19/2010 10:43 AM
Author post count and link in listing.item.html
by mattbunce on 3/19/2010 10:18 AM
RE: News Article Detail and Lightbox
by spirit on 3/19/2010 10:12 AM
RE: News Article Detail and Lightbox
by ray-isc on 3/19/2010 9:49 AM
  Forums  
Subject: DataProvider null value exception
Prev Next
You are not authorized to post a reply.

Author Messages
j hewittUser is Offline
Registered Users
Ventrian Newbie
Ventrian Newbie
Posts:2

12/07/2005 8:22 AM  

Hi,

I've been beating my head against the dataProvider class for about a week now with no luck.  Specifically the following line:

objProvider = CType(Framework.Reflection.CreateObject("data", "sandbox.DNN.Modules.pictureAlbum.Data", "sandbox.pictureAlbum", DataProvider)

Please correct me if I am wrong, but from my understanding the CreateObject method takes the following parameters:

1)  objectProvider - which is referenced in the web.config
2)  objectNamespace - which is the namespace where the dataProvider class resides
3)  objectAssemplyName - which is the actual name of your projects compiled dll

My dataProvider class resides in the following namespace:

Namespace sandbox.DNN.Modules.pictureAlbum.Data

In case it makes a difference, the SqlDataProvider class namespace is:

Namespace sandbox.DNN.Modules.pictureAlbum.SQLDataProvider.Data

Taking a look into the object browser in visual studio confirms the above namespaces.  Also, both projects are compiled into the <dotNetNuke>\bin directory (DNNDev\bin on my computer) by the following names:

sandbox.pictureAlbum.dll - for the module
sandbox.pictureAlbum.SqlDataProvider.dll - for the sql data provider

The on the fly provider creator in the dataProvider class looks like this in my code:

objProvider = CType(Framework.Reflection.CreateObject("data", "sandbox.DNN.Modules.pictureAlbum.Data", "sandbox.pictureAlbum", DataProvider)

Finally, this is a new installation of dnn 3.2.0 on my localhost and the module was created using the templates from dnnjungle.

Every call to the createObject method results in the following exception (everything else works fine:  module loads, etc.):

Error: Edit Picture Album is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: The type initializer for "sandbox.DNN.Modules.pictureAlbum.Data.DataProvider" threw an exception. ---> System.TypeInitializationException: The type initializer for "sandbox.DNN.Modules.pictureAlbum.Data.DataProvider" threw an exception. ---> System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName) at sandbox.DNN.Modules.pictureAlbum.Data.DataProvider.CreateProvider() in C:\Inetpub\wwwroot\DNNDev\DesktopModules\pictureAlbum\Components\DataProvider.vb:line 20 at sandbox.DNN.Modules.pictureAlbum.Data.DataProvider..cctor() in C:\Inetpub\wwwroot\DNNDev\DesktopModules\pictureAlbum\Components\DataProvider.vb:line 15 --- End of inner exception stack trace --- at sandbox.DNN.Modules.pictureAlbum.Data.DataProvider.Instance() at sandbox.DNN.Modules.pictureAlbum.Business.pictureAlbumController.get_isDuplicateAlbumNameInPortal(Int32 portalID, String albumName) in C:\Inetpub\wwwroot\DNNDev\DesktopModules\pictureAlbum\Components\pictureAlbumController.vb:line 15 at sandbox.DNN.Modules.pictureAlbum.pictureAlbumEdit.vaidateTitle() in C:\Inetpub\wwwroot\DNNDev\DesktopModules\pictureAlbum\pictureAlbumEdit.ascx.vb:line 146 at sandbox.DNN.Modules.pictureAlbum.pictureAlbumEdit.btnAddAlbum_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\DNNDev\DesktopModules\pictureAlbum\pictureAlbumEdit.ascx.vb:line 74 --- End of inner exception stack trace ---

I've read several posts with no luck.  Thanks in advance for any and all help on this issue.

Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17204


12/08/2005 3:50 AM  

Things to check:-

  • Make sure there is no default namespace and your namespace is correct, e.g. sandbox.DNN.Modules.pictureAlbum.Data
  • Make sure there is no other assemblies in your bin directory it could be getting confused with. (Especially true if you rename)

Do you have the dotnetnuke project so you can step through what is happening? Is it a VB or C# Module?


Scott McCulloch
Site Administrator
Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17204


12/08/2005 3:52 AM  

Here is mine from PM:-

Private Shared Sub CreateProvider()

objProvider = CType(Framework.Reflection.CreateObject("data", "DnnForge.PrivateMessages", "DnnForge.PrivateMessages", DataProvider)

End Sub

My assembly is called "DnnForge.PrivateMessages.SqlDataProvider" and my namespace is DnnForge.PrivateMessages.SqlDataProvider"

I think the CreateObject adds the defaultProvider to the call..


Scott McCulloch
Site Administrator
Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17204


12/08/2005 3:54 AM  

Have you looked at the hello world tutorial on DnnJungle? I think your data provider isn't being loaded correctly..

You can find the tutorial here..


Scott McCulloch
Site Administrator
j hewittUser is Offline
Registered Users
Ventrian Newbie
Ventrian Newbie
Posts:2

12/08/2005 8:56 AM  

Smcculloch,  Thanks for all of your help, I've determined what the problem is and everything is working fine now.

Basically, everything above is correct except for one thing.  The namespace for the sqlDataProvider class is:

Namespace sandbox.DNN.Modules.pictureAlbum.SQLDataProvider.Data

When it should be in the same namespace as the abstract dataProvider class in the module project which is:

Namespace sandbox.DNN.Modules.pictureAlbum.Data.

So, for anyone else reading this post in the future, if you are having similar problems check the following:

1)  Make sure that both the sqlDataProvider class and the DataProvider class are in the same namespace.
2)  Verify those namespaces using the object browser in visual studio
3)  Verify that the solution outputs the dlls for both the module and data provider projects to the dotNetNuke bin directory
4)  the CreateObject call in the dataProvider class should be as follows:

CreateObject("data", "<NAMESPACE OF DATAPROVIDERS>", "<NAME OF MODULE DLL>", DataProvider)

Where the following explainations apply:

<NAMESPACE OF DATAPROVIDERS> = The namespace of the dataprovider class in the module project and the namespace of the sqldataprovider class in the dataProvider project (they should be in the same namespace).

<NAME OF MODULE DLL> = This is the name of the module dll that should be compiled into the dotNetNuke bin directory when the project is built (minus the ".dll" extension).

I hope that this helps any readers in the future avoid any of the heartache I've been through trying to figure this out.

I've set this post to email me if any replies are posted, please feel free to contact me if you are experiencing similar problems and the latter steps do not resolve the issue.

Scott McCullochUser is Offline
Administrators
Ventrian Master
Ventrian Master
Posts:17204


12/08/2005 2:36 PM  
Thanks for sharing this information and I'm glad you got it working

Scott McCulloch
Site Administrator
You are not authorized to post a reply.
Forums > General > DotNetNuke Questions > DataProvider null value exception



ActiveForums 3.7