This project is read-only.

Invalid item(s) in database

Topics: Developer Forum
Dec 8, 2008 at 8:16 PM
Hello,
  first of all my compliments for N2, that I like very much (even if I'm using it since very few time).
Now after the sugar, a bit of salt :-)

I have a site that I realized in ASP.NET 2.0 some time ago. Recently, I have been asked to add a news section, since I didn't want to reinvent the wheel, I searched around for something that saved me to waste my time in doing something buggy and not powerful.
In my search for "something" I gave a look to many products (mostly cms) and, finally, I encountered N2.
I worked a bit to integrate it into my existing site (without rewriting the site from scratch...) and, at the end, it worked.

So, proud of myself, I went to publish the thing online, i.e. I started to move my integration job from my local PC to a hosting (where the existing site lives happily).


Suddenly all my hopes crashed like a plane without wings: each time I tried to access the site I was being redirected to the installation procedure (.../edit/install), but when there, even after recreating the DB I was unable to choose a start page and a root page (the drop down boxes where empty).

I tried then to remove from web.config the lines that makes you go to the installation (i.e. <installer checkInstallationStatus="true" />), doing that I got what you find at the bottom of the post.

Please help!!!

Regards,
                   Danilo Turina

-------------------

Invalid item(s) in database

An invalid class was found in the database (NHibernate.InvalidClassException). A few possible explanations:

  • Missing dll. A dll containing class definitions (e.g. n2.edit.dll) is no longer available in the /bin folder
  • Changed or removed class. The name of a class has changed or a class has been removed. E.g. a content class such as
    [Definition]public class PageItem
    could have been renamed to
    [Definition]public class OtherPageItem
  • Changed discriminator. The discriminator of a class definition has changed e.g.
    [Definition("My page", "Discriminator")]public class MyPage...
    [Definition("My page", "ChangedDiscriminator")]public class MyPage...
  • UFO landing. Someone did nasty experiments to your database...

To fix it you can either

  • Act intelligently upon the this information.
  • Try <input type="submit" name="ctl02" value="deleting" onclick="return confirm('The nodes and all their CHILD nodes will be DELETED completly and irrecoverably. You can't get them back afterwards. Please note that child nodes of other types that could otherwise work also will be deleted. Delete?');" style="vertical-align: middle; " /> the offending nodes (use at own risk).
  • Try <input type="submit" name="Button1" value="changing" onclick="return confirm('This option may result in an invalid database state such as stale data and traumatized application logic. Please use with caution. Continue?');" id="Button1" style="vertical-align: middle; " /> them into a <select name="ddlType" id="ddlType">  <option value="Wonderland">Wizard Container</option>   <option value="MagicLocation">Magic Location</option>   <option value="User">User</option>   <option value="UserList">User List</option>   <option value="File">File</option>   <option value="Directory">Directory</option>   <option value="TrashContainerItem">Trash</option>   <option value="RootDirectory">File Folder</option>   </select> (use with caution).

These are are the problematic classes in the database. Their type/discriminator doesn't match any content class definition (class name or attribute name/discriminator) in the application:

ID Type Created Published Updated Expires Name ZoneName Title SortOrder Visible SavedBy VersionOfID ParentID
2 StartPage 08/12/2008 20.50.15 08/12/2008 20.50.15 08/12/2008 20.50.15   start   Start page 10000 0 admin   1
Dec 8, 2008 at 8:50 PM
Can you check if your host runs your application under Medium Trust. Take a look at this disscusssion to see how you should set up your site to work in medium trust.
I had the same problem until I realized that the Medium Trust was the issue, so I just followed the settings above...and it worked.
Dec 8, 2008 at 8:55 PM
Could you specifically check the configured assemblies:

    <engine>
      <assemblies>
        <add assembly="N2"/>
        <add assembly="N2.Security"/>
        <add assembly="N2.Edit"/>
        <add assembly="YourProject"/>
      </assemblies>

Please report any success (or lack thereof). What hosting provider are you using?


Dec 14, 2008 at 10:10 AM
Thank you very much Libarbo, after a bit of headbanging (due to the (wrong) way, I had organized my project) it worked.

A side effect of this is that now a know better both ASP.NET development and N2.

Thank you,
                       Danilo Turina

P.S. The hosting provider for the site I'm working on is Aruba (www.aruba.it/).
Sep 23, 2009 at 2:04 PM
Edited Sep 23, 2009 at 7:23 PM

Hi,

I have similar problem, after upgrading 1.4.4->1.5. I've replaced all Template Starters Kit except database, Templates folder, my App_Themes folder and web.config

 


 

Invalid item(s) in database (class namechange or missing dll?)

An invalid class was found in the database (NHibernate.InvalidClassException). A few possible explanations:

  • Missing dll. A dll containing class definitions (e.g. n2.edit.dll) is no longer available in the /bin folder
  • Changed or removed class. The name of a class has changed or a class has been removed. E.g. a content class such as
    [Definition]
    public class PageItem
    could have been renamed to
    [Definition]
    public class OtherPageItem
  • Changed discriminator. The discriminator of a class definition has changed e.g.
    [Definition("My page", "Discriminator")]
    public class MyPage...
    [Definition("My page", "ChangedDiscriminator")]
    public class MyPage...
  • UFO landing. Someone did nasty experiments to your database...

To fix it you can either

  • Act intelligently upon the this information.
  • Try <input onclick="return confirm('The nodes and all their CHILD nodes will be DELETED completly and irrecoverably. You can't get them back afterwards. Please note that child nodes of other types that could otherwise work also will be deleted. Delete?');" name="ctl02" type="submit" value="deleting" /> the offending nodes (use at own risk).
  • Try <input id="Button1" onclick="return confirm('This option may result in an invalid database state such as stale data and traumatized application logic. Please use with caution. Continue?');" name="Button1" type="submit" value="changing" /> them into a <select id="ddlType" name="ddlType"> <option value="Subscribe">Subscribe</option> <option value="Statistics">Statistics</option> <option value="StartPage">Start Page</option> <option value="TextPage">Text Page</option> <option value="Text">Text</option> <option value="Teaser">Teaser</option> <option value="SocialBookmarks">Social bookmarks</option> <option value="RssAggregatorItem">Rss List</option> <option value="RootPage">Root Page</option> <option value="Redirect">Redirect</option> <option value="SiteMap">Site Map</option> <option value="SingleSelect">Single Select (radio buttons)</option> <option value="RssFeed">Feed</option> <option value="TrashContainerItem">Trash</option> <option value="RootDirectory">File Folder</option> <option value="File">File</option> <option value="MyPage">My First Page</option> <option value="Wonderland">Wizard Container</option> <option value="MagicLocation">Magic Location</option> <option value="Directory">Directory</option> <option value="Tracking">Tracking script</option> <option value="Top">Top</option> <option value="TextQuestion">Text question (textbox)</option> <option value="User">User</option> <option value="UserList">User List</option> <option value="UserRegistration">Register</option> <option value="ControlPanel">Control Panel</option> <option value="CommentList">Comment List</option> <option value="CommentInput">Comment Input Form</option> <option value="Faq">FAQ Item</option> <option value="Event">Event</option> <option value="DatabaseSearch">Database Search</option> <option value="Comment">Comment</option> <option value="BubbleItem">Bubble</option> <option value="BoxedText">Boxed Text</option> <option value="LanguageRoot">Language root</option> <option value="Columns">Two column container</option> <option value="CalendarTeaser">Calendar Teaser</option> <option value="Calendar">Calendar</option> <option value="NewsList">News List</option> <option value="NewsContainer">News Container</option> <option value="News">News</option> <option value="RandomImage">Random image</option> <option value="Poll">Poll</option> <option value="Option">Option</option> <option value="MultipleSelect">Multiple Select (check boxes)</option> <option value="FormPage">Form page</option> <option value="Form">Form</option> <option value="FaqList">Frequently Asked Questions</option> <option value="Login">Login</option> <option value="ImageGallery">Image Gallery</option> <option value="GalleryItem">Gallery Item</option> </select> (use with caution).

These are are the problematic classes in the database. Their type/discriminator doesn't match any content class definition (class name or attribute name/discriminator) in the application:

ID Type Created Published Updated Expires Name ZoneName Title SortOrder Visible SavedBy VersionOfID ParentID
371 TabsItem 2009-06-22 02:00:22 2009-06-22 02:00:22 2009-06-22 02:00:54 2009-06-22 02:00:54 371 Content   10013 True admin   74

 


 

Help please!

 

best regards,

gRRuby

Sep 23, 2009 at 10:06 PM

Are you using the TabsItem? If not just delete it using the form you posted. If you are using it you need to compile a version (it's in the source release) and add it to your site.

Sep 23, 2009 at 10:43 PM
Edited Sep 24, 2009 at 11:53 AM

Thx a lot !

I just deleted the TabsItem and now everythink is OK :-)