Castle Windsor & NHibernate facility: Value cannot be null. Parameter name: classType

2k views Asked by At

Hi I am attempting to use Castle windsor Nhibernate Facility with fluent Nhibernate and Im getting the error above, as far as Im aware , I have followed the instructions on setting this up. Has anyone else seen this issue and maybe offer some advice? Thanks

Value cannot be null.
Parameter name: classType
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.ArgumentNullException: Value cannot be null.
Parameter name: classType

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:

[ArgumentNullException: Value cannot be null.
Parameter name: classType]
   Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle, Boolean overwriteLifestyle) +191
   Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle) +48
   Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType) +45
   Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterDefaultConfigurationBuilder() +154
   Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterComponents() +29
   Castle.Facilities.NHibernateIntegration.NHibernateFacility.Init() +196
   Castle.MicroKernel.Facilities.AbstractFacility.Init(IKernel kernel, IConfiguration facilityConfig) +61
   Castle.MicroKernel.DefaultKernel.AddFacility(String key, IFacility facility) +182
   Castle.Windsor.WindsorContainer.AddFacility(String key, IFacility facility) +49
   Castle.Windsor.Installer.DefaultComponentInstaller.SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container) +242
   Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) +89
   Castle.Windsor.WindsorContainer.RunInstaller() +76
   Castle.Windsor.WindsorContainer..ctor(IConfigurationInterpreter interpreter) +144
   KingMaker.Web.Windsor.ContainerBuilder.Build(String config) +90
   KingMaker.Web.MvcApplication.InitializeWindsor() +74
   KingMaker.Web.MvcApplication.Application_Start() +55

Here is the facility xml facility

<facility
        id="nhibernatefacility"
        type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration"
  isWeb="true"
        configurationBuilder="App.Web.Maps.FluentNHibernateConfigurationBuilder, App.Web">

  <!-- configuration here is overriden by the FluentNHibernateConfigurationBuilder -->
  <factory id="sessionFactory1">
    <settings>
      <item key="connection.provider">NHibernate.Connection.DriverConnectionProvider</item>
      <item key="connection.driver_class">NHibernate.Driver.SqlClientDriver</item>
      <item key="connection.connection_string">Data Source=localhost\sqlexpress;Initial Catalog=FIDPortal;Integrated Security=SSPI</item>
      <item key="dialect">NHibernate.Dialect.MsSql2005Dialect</item>
      <item key="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</item>
    </settings>
    <!--        <assemblies>-->
    <!--          <assembly>Castle.Facilities.NHibernateIntegration.Tests</assembly>-->
    <!--        </assemblies>-->
  </factory>
</facility>

1

There are 1 answers

0
Mauricio Scheffer On BEST ANSWER

The stack trace says the type defined in the configurationBuilder attribute (FluentNHibernateConfigurationBuilder) is invalid or not found. Double-check the namespace and assembly name.