0
votes

My Apps was developed with NHibernate Working fine on my system but giving this error on the host Server

Index was outside the bounds of the array. 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.IndexOutOfRangeException: Index was outside the bounds of the array.

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:

[IndexOutOfRangeException: Index was outside the bounds of the array.] NHibernate.Dialect.Dialect.IsQuoted(String name) +84 NHibernate.Dialect.Dialect.QuoteForSchemaName(String schemaName) +20 NHibernate.Cfg.HbmBinder.MakeIdentifier(XmlNode node, SimpleValue model, Mappings mappings) +228 NHibernate.Cfg.HbmBinder.BindRootClass(XmlNode node, RootClass model, Mappings mappings) +1223 NHibernate.Cfg.HbmBinder.BindRoot(XmlDocument doc, Mappings mappings) +398 NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +69

[MappingException: Could not compile the mapping document: CMS.Common.Mapping.CMS.Common.Data.AccountPeriod.hbm.xml] NHibernate.Cfg.Configuration.LogAndThrow(MappingException me) +40 NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +137 NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name) +29 NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) +109 NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) +185 NHibernate.Cfg.Configuration.AddResources(Assembly assembly, IList resources, Boolean skipOrdering) +166 NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) +32 NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) +150 NHibernate.Cfg.Configuration.DoConfigure(XmlDocument doc) +644 NHibernate.Cfg.Configuration.Configure(XmlTextReader reader) +304 NHibernate.Cfg.Configuration.Configure(XmlNode node) +81 NHibernate.Cfg.Configuration.Configure() +35 ProjectBase.Data.NHibernateSessionManager.InitSessionFactory() +60 ProjectBase.Data.NHibernateSessionManager..ctor() +39 ProjectBase.Data.Nested..cctor() +39

[TypeInitializationException: The type initializer for 'Nested' threw an exception.] ProjectBase.Data.NHibernateSessionManager.get_Instance() +38 CMS.Facade.CoreSystem.BuildSession() in C:\Users\Oladapo\Documents\Visual Studio 2008\Projects\Property Manager\CMS.Facade\CoreSystem.cs:440 CMS.Facade.AdvertSystem.RetrieveAllAdvert() in C:\Users\Oladapo\Documents\Visual Studio 2008\Projects\Property Manager\CMS.Facade\AdvertSystem.cs:16

[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +488 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247 System.Web.UI.WebControls.BaseDataList.GetData() +38 System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +153 System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +54 System.Web.UI.WebControls.BaseDataList.DataBind() +55 System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +60 System.Web.UI.WebControls.BaseDataList.CreateChildControls() +69 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +44 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

3

3 Answers

0
votes

After adding some NHibernate goodness to a project, I had similar problems deploying because I forgot to update the web.config file on production. Once I defined the hibernate-configuration section, everything worked.

0
votes

Also happened to me when I had an empty enum defined.

0
votes

That you have a MappingException included in your stack trace is key. This implies either a problem with your class mappings, or your NHibernate configuration. It could also be that your database does not contain tables or fields defined in your class mappings.

To be more specific, you would need to provide additional information.