Invalid object name 'MyTenantNameHere_Settings_ShellDescriptorRecord'.

Topics: Troubleshooting
Mar 5, 2012 at 3:13 AM
Edited Mar 5, 2012 at 3:19 AM

Seeing this error as a YSOD only now upon deploying the package to a new environment.  Oddly enough, it was working well for months in two other environments. This is Orchard 1.3.  

Updated the log4net.config to enable verbose logging.  Database permissions are correct; the table exists; modules are loading correctly; database collation is SQL_Latin1_General_CP1_CI_AS.  Very frustrating.  In this case, it's the second tenant in a pair of tenants.

Here's a detailed excerpt from the log, with large chunks removed where the log lines are mostly repetitive.  "MyTenantNameHere" represents the name of the second tenant.

2012-04-02 22:05:43,751 [5] Orchard.Environment.DefaultOrchardHost - Creating shell context for tenant MyTenantNameHere
2012-04-02 22:05:43,751 [5] Orchard.Environment.ShellBuilders.ShellContextFactory - Creating shell context for tenant MyTenantNameHere
2012-04-02 22:05:43,751 [5] Orchard.Environment.ShellBuilders.ShellContextFactory - No descriptor cached. Starting with minimum components.
2012-04-02 22:05:43,751 [5] Orchard.Environment.ShellBuilders.CompositionStrategy - Composing blueprint
2012-04-02 22:05:43,751 [5] Orchard.Environment.Extensions.ExtensionManager - Loading features
2012-04-02 22:05:43,751 [5] Orchard.Environment.Extensions.ExtensionManager - Done loading features
2012-04-02 22:05:43,766 [5] Orchard.Environment.ShellBuilders.CompositionStrategy - Done composing blueprint
2012-04-02 22:05:43,923 [5] Orchard.Data.SessionLocator - Acquiring session for Orchard.Core.Settings.Descriptor.Records.ShellDescriptorRecord
2012-04-02 22:05:43,923 [5] Orchard.Data.SessionFactoryHolder - Building session factory
2012-04-02 22:05:43,923 [5] Orchard.Data.SessionFactoryHolder - Building configuration
2012-04-02 22:05:43,938 [5] Orchard.Data.SessionFactoryHolder - Done Building configuration
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - checking mappings queue
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - processing one-to-many association mappings
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - processing one-to-one association property references
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - processing foreign key constraints
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - resolving reference to class: Orchard.ContentManagement.Records.ContentItemRecord
...
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - resolving reference to class: Orchard.ContentManagement.Records.ContentItemRecord
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.Configuration - processing filters (second pass)
2012-04-02 22:05:43,938 [5] NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2008Dialect
2012-04-02 22:05:43,938 [5] NHibernate.Exceptions.SQLExceptionConverterFactory - Using dialect defined converter
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Generate SQL with comments: disabled
2012-04-02 22:05:43,938 [5] NHibernate.Connection.ConnectionProviderFactory - Initializing connection provider: NHibernate.Connection.DriverConnectionProvider
2012-04-02 22:05:43,938 [5] NHibernate.Connection.ConnectionProvider - Configuring ConnectionProvider
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Transaction factory: NHibernate.Transaction.AdoNetWithDistrubtedTransactionFactory
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Optimize cache for minimal puts: False
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Connection release mode: auto
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Default batch fetch size: 1
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Statistics: disabled
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Query translator: NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Query language substitutions: {}
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - cache provider: NHibernate.Cache.NoCacheProvider, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Wrap result sets: disabled
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Batcher factory: NHibernate.AdoNet.NonBatchingBatcherFactory, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Default entity-mode: Poco
2012-04-02 22:05:43,938 [5] NHibernate.Cfg.SettingsFactory - Named query checking : enabled
2012-04-02 22:05:43,938 [5] NHibernate.Impl.SessionFactoryImpl - building session factory
2012-04-02 22:05:43,938 [5] NHibernate.Impl.SessionFactoryImpl - Session factory constructed with filter configurations : {}
2012-04-02 22:05:43,938 [5] NHibernate.Impl.SessionFactoryImpl - instantiating session factory with properties: {'connection.provider'='NHibernate.Connection.DriverConnectionProvider', 'proxyfactory.factory_class'='NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle', 'connection.driver_class'='NHibernate.Driver.SqlClientDriver, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4', 'dialect'='NHibernate.Dialect.MsSql2008Dialect, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4', 'hibernate.dialect'='NHibernate.Dialect.MsSql2008Dialect, NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4', 'connection.connection_string'='Data Source=stage-sql1;Initial Catalog=HP_PurchasEdge;Persist Security Info=True;User ID=HP_webuser_Member;Password=serenity_07_mmbr'}
2012-04-02 22:05:43,938 [5] NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
2012-04-02 22:05:43,970 [5] NHibernate.Connection.ConnectionProvider - Closing connection
2012-04-02 22:05:43,970 [5] NHibernate.Tuple.Entity.AbstractEntityTuplizer - No custom accessors found for entity: Orchard.Core.Settings.Models.SiteSettings2PartRecord
2012-04-02 22:05:43,970 [5] NHibernate.Tuple.Entity.AbstractEntityTuplizer - No custom accessors found for entity: Orchard.Core.Settings.Models.SiteSettings2PartRecord
2012-04-02 22:05:43,970 [5] NHibernate.Tuple.Entity.PocoEntityTuplizer - Create Instantiator using optimizer for:Orchard.Core.Settings.Models.SiteSettings2PartRecord
...
2012-04-02 22:05:43,985 [5] NHibernate.Tuple.Entity.PocoEntityTuplizer - Create Instantiator using optimizer for:Orchard.Localization.Records.CultureRecord
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister - Static SQL for collection: Orchard.Core.Settings.Metadata.Records.ContentPartDefinitionRecord.ContentPartFieldDefinitionRecords
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister -  Row insert: UPDATE MyTenantNameHere_Settings_ContentPartFieldDefinitionRecord SET ContentPartDefinitionRecord_Id = ? WHERE Id = ?
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister -  Row delete: UPDATE MyTenantNameHere_Settings_ContentPartFieldDefinitionRecord SET ContentPartDefinitionRecord_Id = null WHERE ContentPartDefinitionRecord_Id = ? AND Id = ?
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister -  One-shot delete: UPDATE MyTenantNameHere_Settings_ContentPartFieldDefinitionRecord SET ContentPartDefinitionRecord_Id = null WHERE ContentPartDefinitionRecord_Id = ?
...
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister - Static SQL for collection: Orchard.ContentManagement.Records.ContentItemRecord.Versions
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister -  Row insert: UPDATE MyTenantNameHere_Orchard_Framework_ContentItemVersionRecord SET ContentItemRecord_Id = ? WHERE Id = ?
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister -  Row delete: UPDATE MyTenantNameHere_Orchard_Framework_ContentItemVersionRecord SET ContentItemRecord_Id = null WHERE ContentItemRecord_Id = ? AND Id = ?
2012-04-02 22:05:43,985 [5] NHibernate.Persister.Collection.ICollectionPersister -  One-shot delete: UPDATE MyTenantNameHere_Orchard_Framework_ContentItemVersionRecord SET ContentItemRecord_Id = null WHERE ContentItemRecord_Id = ?
...
2012-04-02 22:05:44,016 [5] NHibernate.Loader.Collection.OneToManyLoader - Static select for one-to-many Orchard.Core.Settings.Descriptor.Records.ShellDescriptorRecord.Features: SELECT features0_.ShellDescriptorRecord_Id as ShellDes3_1_, features0_.Id as Id1_, features0_.Id as Id370_0_, features0_.Name as Name370_0_, features0_.ShellDescriptorRecord_id as ShellDes3_370_0_ FROM MyTenantNameHere_Settings_ShellFeatureRecord features0_ WHERE features0_.ShellDescriptorRecord_Id=?
2012-04-02 22:05:44,016 [5] NHibernate.Loader.Collection.OneToManyLoader - Static select for one-to-many Orchard.Core.Settings.Descriptor.Records.ShellDescriptorRecord.Parameters: SELECT parameters0_.ShellDescriptorRecord_Id as ShellDes5_1_, parameters0_.Id as Id1_, parameters0_.Id as Id371_0_, parameters0_.Component as Component371_0_, parameters0_.Name as Name371_0_, parameters0_.Value as Value371_0_, parameters0_.ShellDescriptorRecord_id as ShellDes5_371_0_ FROM MyTenantNameHere_Settings_ShellParameterRecord parameters0_ WHERE parameters0_.ShellDescriptorRecord_Id=?
2012-04-02 22:05:44,016 [5] NHibernate.Loader.Collection.OneToManyLoader - Static select for one-to-many Orchard.ContentManagement.Records.ContentItemRecord.Versions: SELECT versions0_.ContentItemRecord_Id as ContentI6_1_, versions0_.Id as Id1_, versions0_.Id as Id374_0_, versions0_.Number as Number374_0_, versions0_.Published as Published374_0_, versions0_.Latest as Latest374_0_, versions0_.Data as Data374_0_, versions0_.ContentItemRecord_id as ContentI6_374_0_ FROM MyTenantNameHere_Orchard_Framework_ContentItemVersionRecord versions0_ WHERE versions0_.ContentItemRecord_Id=?
2012-04-02 22:05:44,016 [5] NHibernate.Impl.SessionFactoryObjectFactory - registered: 2c4cc76800b744a7bb3837371730acf4(unnamed)
2012-04-02 22:05:44,016 [5] NHibernate.Impl.SessionFactoryObjectFactory - no name configured
2012-04-02 22:05:44,016 [5] NHibernate.Impl.SessionFactoryImpl - Instantiated session factory
..
2012-04-02 22:05:44,016 [5] NHibernate.Impl.SessionFactoryImpl - Checking 0 named SQL queries
2012-04-02 22:05:44,016 [5] Orchard.Data.SessionFactoryHolder - Done building session factory
2012-04-02 22:05:44,016 [5] Orchard.Data.TransactionManager - Creating transaction on Demand
2012-04-02 22:05:44,016 [5] Orchard.Data.SessionLocator - Openning database session
2012-04-02 22:05:44,016 [5] NHibernate.Impl.SessionImpl - [session-id=c8cefc11-5d6c-43a1-8a8f-48af5ad2a215] opened session at timestamp: 634690011440, for session factory: [/2c4cc76800b744a7bb3837371730acf4]
2012-04-02 22:05:44,016 [5] NHibernate.Impl.AbstractSessionImpl - enlisted into DTC transaction: ReadCommitted
2012-04-02 22:05:44,016 [5] NHibernate.Loader.Criteria.CriteriaQueryTranslator - put criteria=1=1 alias=this0_
2012-04-02 22:05:44,016 [5] NHibernate.Loader.Criteria.CriteriaQueryTranslator - returning alias=this_ for criteria=1=1
2012-04-02 22:05:44,016 [5] NHibernate.AdoNet.AbstractBatcher - Opened new IDbCommand, open IDbCommands: 1
2012-04-02 22:05:44,016 [5] NHibernate.AdoNet.AbstractBatcher - Building an IDbCommand object for the SqlString: SELECT top 2 this_.Id as Id372_0_, this_.SerialNumber as SerialNu2_372_0_ FROM MyTenantNameHere_Settings_ShellDescriptorRecord this_ WHERE 1=1
2012-04-02 22:05:44,016 [5] NHibernate.Loader.Loader - SELECT top 2 this_.Id as Id372_0_, this_.SerialNumber as SerialNu2_372_0_ FROM MyTenantNameHere_Settings_ShellDescriptorRecord this_ WHERE 1=1
2012-04-02 22:05:44,016 [5] NHibernate.SQL - SELECT top 2 this_.Id as Id372_0_, this_.SerialNumber as SerialNu2_372_0_ FROM MyTenantNameHere_Settings_ShellDescriptorRecord this_ WHERE 1=1
2012-04-02 22:05:44,016 [5] NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
2012-04-02 22:05:44,016 [5] NHibernate.AdoNet.AbstractBatcher - Could not execute query: SELECT top 2 this_.Id as Id372_0_, this_.SerialNumber as SerialNu2_372_0_ FROM MyTenantNameHere_Settings_ShellDescriptorRecord this_ WHERE 1=1
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'MyTenantNameHere_Settings_ShellDescriptorRecord'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
   at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
Mar 5, 2012 at 5:02 AM

Never mind. Error in Settings.txt.  We have two databases in play, and the second tenant settings.txt file had the wrong database name.  It pays to be detail-oriented. :-/