Object with id: 1 was not of the specified sublcass: N2.ContentItem (Discriminator was: 'StartPageItem')

Topics: Developer Forum
May 31, 2007 at 5:51 PM
I get this error often now, but not all the time?!?:Object with id: 1 was not of the specified sublcass: N2.ContentItem (Discriminator was: 'StartPageItem')
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: NHibernate.WrongClassException: Object with id: 1 was not of the specified sublcass: N2.ContentItem (Discriminator was: 'StartPageItem')

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


WrongClassException: Object with id: 1 was not of the specified sublcass: N2.ContentItem (Discriminator was: 'StartPageItem')
NHibernate.Loader.Loader.GetInstanceClass(IDataReader rs, Int32 i, ILoadable persister, Object id, ISessionImplementor session) +205
NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session) +42
NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session) +271
NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies) +178
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +496
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) +56
NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Type optionalEntityName, Object optionalIdentifier, IEntityPersister persister) +261
NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId) +32
NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session) +17
NHibernate.Persister.Entity.AbstractEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session) +117
NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted) +960
NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation) +129
NHibernate.Impl.SessionImpl.Get(Type clazz, Object id) +78
NHibernate.Impl.SessionImpl.Get(Object id) +68
N2.Persistence.NH.NHRepository`2.Get(TKey id) +89
N2.Persistence.NH.DefaultPersistenceManager.Get(Int32 id) +12
N2.Web.DefaultUrlParser.get_StartPage() +26
N2.Web.DefaultUrlParser.Parse(String url) +52
N2.Security.DefaultSecurityManager.AuthorizeRequest(IWebContext context) +186
N2.Web.DefaultRequestLifeCycleHandler.OnAuthorizeRequest(Object sender, EventArgs e) +13
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


I get the page then his a refresh, and I get this error?
Any idea what it could be?
I've checked my inheretance, and it seems right. And again the wierd part is that does work some times. I use 1.2.0.

Regards,
Morten (Norway btw :-))
Coordinator
May 31, 2007 at 7:42 PM
Thats a weird timing issue related to the re-loading of assemblies that I havn't figured out yet.

Could you please check your web.config and see if EnsureBinFolderAssembliesLoaded is configured.
  <castle>
...
    <include uri="assembly://N2/Engine/n2.configuration.xml"/>
    <components>
      <component id="n2.typeFinder">
        <parameters>
          <EnsureBinFolderAssembliesLoaded>true</EnsureBinFolderAssembliesLoaded>
        </parameters>
      </component>
    </components>
  </castle>
...

Regards,
Cristian
May 31, 2007 at 8:21 PM
That line was commented out...
I removed the comment tags and canged the value to true.
Seems to work better now!
Thank you!

Btw, something completly different, in edit there is a linkt to user management /edit/Management/Users.aspx, but the Management folder is missing. You got an eta on that?

On a final note I'd like to say that I really like N2! As you, I work with epi server during daytime. I love your model!
Thank you!

Regards,
Morten
Coordinator
May 31, 2007 at 8:28 PM

Btw, something completly different, in edit there is a linkt to user management /edit/Management/Users.aspx, but the Management folder is missing. You got an eta on that?


I havn't used that in a while. Have you checked the source code version or is something broken?


On a final note I'd like to say that I really like N2! As you, I work with epi server during daytime. I love your model!


=)

/Cristian