Skip to content
June 4, 2014 / kiranpatils

Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.

Challenge:

One fine day, we were setting up our CD Servers, and as you know you should not have “master” DB references on your DB Server. To do that we were following Scaling Guide‘s Chapter 4.6. After doing all these changes, when we requested a Sitecore with hope to see the output. Unfortunately we cam e across following error:

Server Error in ‘/’ Application.


Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.

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: Sitecore.Exceptions.ConfigurationException: Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.

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:

[ConfigurationException: Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.]
   Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +394
   Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +141
   Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) +420
   Sitecore.Configuration.Factory.GetDatabase(String name, Boolean assert) +185
   Sitecore.Configuration.Factory.GetDatabases() +168
   Sitecore.Data.Managers.HistoryManager.InitializeEventHandlers() +49
   Sitecore.Pipelines.Loader.InitializeManagers.Process(PipelineArgs args) +16
   (Object , Object[] ) +80
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
   Sitecore.Nexus.Web.HttpModule.Application_Start() +172
   Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +516
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Could not create instance of type: Sitecore.Data.Database. No matching constructor was found.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12601936
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12441597

 

CD-Setup

Just a note : The version which we were configuring was 7.X

You are also facing the same error? Don’t know where to look at? Client/Your team wants CD Server ASAP? Don’t worry we have a solution for you!

Solution:

One thing we were sure that this is something to do with master DB only. So, we started looking at config file’s under App_Config folder and here’s our HERO — Sitecore.Buckets.config:

<databases>
      <database id="master" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
        <Engines.DataEngine.Commands.AddFromTemplatePrototype>
          <obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
        </Engines.DataEngine.Commands.AddFromTemplatePrototype>
      </database>
      <database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
        <Engines.DataEngine.Commands.AddFromTemplatePrototype>
          <obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
        </Engines.DataEngine.Commands.AddFromTemplatePrototype>
      </database>
    </databases>
    <events>

So, we commented out master DB’s Configuration and here’s how it looks like:

<databases>
<!--<database id="master" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<Engines.DataEngine.Commands.AddFromTemplatePrototype>
<obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
</Engines.DataEngine.Commands.AddFromTemplatePrototype>
</database>-->
<database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<Engines.DataEngine.Commands.AddFromTemplatePrototype>
<obj type="Sitecore.Buckets.Commands.AddFromTemplateCommand, Sitecore.Buckets" />
</Engines.DataEngine.Commands.AddFromTemplatePrototype>
</database>
</databases>

And Yes, It resolved our error, What?! Yours as well?! Glad to know that!

I hope Sitecore team updates the same in their Scaling Guide as well — Happy to be corrected!

Happy CDing! 🙂

Good reads:

http://www.sitecoredevelopment.com/MarkGraber/2013/June/Tips-on-Setting-up-a-Content-Delivery-Server-with-No-Master-Database.aspx

Advertisements

5 Comments

Leave a Comment
  1. umeshwali / Jun 18 2014 6:29 am

    Hi Kiran, thanks for sharing your knowledge on Sitecore. Its helpfull for newbees like me. Can you please explain in more detail the reason for commenting out the master database fro the sitecore.bucket.config?

    • kiranpatils / Jun 21 2014 3:34 pm

      Umesh — Thanks for the nice words!

      Usually on CD Servers, We don’t keep master database setting.

      Kiran

  2. Matt Vandermolen / Jul 20 2014 9:23 pm

    Thanks for the help! Just for anyone else experiencing this problem error, for my particular implementation there were also Solr and Brightcove references that needed to be changed 🙂

  3. Micha / Mar 24 2015 3:58 pm

    Hi Kiran,

    This really helped me out today. But I was curious why this wasn’t a problem for me before. That’s because I renamed the, by Sitecore suggested, file SwitchMasterToWeb.config to ALL-SwitchMasterToWeb.config (because of local standards).

    After this name change, the SwitchMasterToWeb file was alphabetically sorted above Sitecore.Bucket.config file. It looks like Sitecore processes the patch include file by alphabeth.

    A revert of changes in de Sitecore.Bucket.config and a rename to Z-ALL-SwitchMasterToWeb is also working for me.

    I based my CM – CD installation on “Sitecore CMS 7.0 or later – Scaling Guide” via SDN.

    KR
    Micha

    • kiranpatils / Apr 19 2015 6:36 pm

      Good to know — Thanks Micha for sharing your learnings! Much appreciated!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: