title: Spring.Net 2, NHibernate 4 Error "Could not load type from string value 'Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate'."
body: <p>I'm attempting to upgrade a project from Spring.Net 1.3.2, NHibernate 3.2 to Spring.Net 2, NHibernate 4.</p>
  
  <p>I get the error "Could not load type from string value 'Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate'." When I try to run.</p>
  
  <p>My log shows:</p>
  
  <pre><code>System.Configuration.ConfigurationErrorsException: Error creating context 'spring.root': Could not load type from string value 'Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate'. ---&gt; Spring.Objects.Factory.ObjectCreationException: Error thrown by a dependency of object 'transactionAdvisor' defined in 'file [C:\Users\...\Project.Web\Config\transaction.aop.xml] line 7' : Initialization of object failed : Cannot resolve type [Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate] for object with name 'transactionManager' defined in file [C:\Users\...\Project.Web\Config\hibernate.cfg.xml] line 45
   while resolving 'TransactionInterceptor' to 'transactionInterceptor' defined in 'file [C:\Users\...\Project.Web\Config\transaction.aop.xml] line 12' ---&gt; Spring.Core.CannotLoadObjectTypeException: Cannot resolve type [Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate] for object with name 'transactionManager' defined in file [C:\Users\...\Project.Web\Config\hibernate.cfg.xml] line 45 ---&gt; System.TypeLoadException: Could not load type from string value 'Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate'.
     at Spring.Core.TypeResolution.TypeResolver.Resolve(String typeName) in c:\_prj\spring-net\src\Spring\Spring.Core\Core\TypeResolution\TypeResolver.cs:line 81
  </code></pre>
  
  <p>If I just open a cs file and create a Spring.Data.NHibernate.LocalSessionFactoryObject it looks fine, and the namespace is correct.
  I did change the references due to version changes.  Here's what I have now:</p>
  
  <p>transaction.aop.xml</p>
  
  <pre><code>  &lt;object id="transactionAdvisor" type="Spring.Transaction.Interceptor.TransactionAttributeSourceAdvisor, Spring.Data"&gt;
          &lt;property name="TransactionInterceptor" ref="transactionInterceptor"/&gt;
    &lt;/object&gt;
  
    &lt;!-- Transaction Interceptor --&gt;
    &lt;object id="transactionInterceptor" type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data"&gt;
          &lt;property name="TransactionManager" ref="transactionManager"/&gt;
          &lt;property name="TransactionAttributeSource" ref="attributeTransactionAttributeSource"/&gt;
    &lt;/object&gt;
  
    &lt;object id="attributeTransactionAttributeSource" type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource, Spring.Data"&gt;
    &lt;/object&gt;
  </code></pre>
  
  <p>hibernate.cfg.xml</p>
  
  <pre><code>&lt;object id="placeholder_db_settings" type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core"&gt;
      &lt;property name="ConfigSections" value="databaseSettings,appSettings,emailSettings"/&gt;
  &lt;/object&gt;
  
  &lt;db:provider id="DbProvider" provider="SqlServer-2.0" connectionString="Data Source=${db.datasource};Database=${db.database};User ID=${db.user};Password=${db.password};Connect Timeout=${db.connectTimeout}"/&gt;
  
  &lt;object id="hibernateSessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate"&gt;
      &lt;property name="DbProvider" ref="DbProvider"/&gt;
      &lt;property name="MappingAssemblies"&gt;
          &lt;list&gt;
              &lt;value&gt;IBB.BusinessNet.Services&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="HibernateProperties"&gt;
          &lt;dictionary&gt;
              &lt;entry key-ref="connection.provider" value-ref="NHibernate.Connection.DriverConnectionProvider"/&gt;
              &lt;entry key-ref="show_sql" value-ref="false"/&gt;
              &lt;entry key-ref="dialect" value-ref="NHibernate.Dialect.MsSql2008Dialect"/&gt;
              &lt;entry key-ref="connection.driver_class" value-ref="NHibernate.Driver.SqlClientDriver"/&gt;
              &lt;entry key-ref="connection.pool_size" value-ref="10"/&gt;
              &lt;entry key-ref="query.substitutions" value-ref="true 1, false 0, yes 'Y', no 'N'"/&gt;
              &lt;entry key-ref="use_outer_join" value-ref="true"/&gt;
              &lt;entry key-ref="command_timeout" value-ref="840" /&gt;
              &lt;entry key-ref="cache.provider_class" value-ref="NHibernate.Caches.SysCache2.SysCacheProvider,NHibernate.Caches.SysCache2" /&gt;
          &lt;/dictionary&gt;
      &lt;/property&gt;
      &lt;property name="ExposeTransactionAwareSessionFactory" value="true" /&gt;
  &lt;/object&gt;
  
  &lt;object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate"&gt;
      &lt;property name="DbProvider" ref="DbProvider"/&gt;
      &lt;property name="SessionFactory" ref="hibernateSessionFactory"/&gt;
  &lt;/object&gt;
  
  &lt;object id="MyHibernateTemplate" type="Spring.Data.NHibernate.Generic.HibernateTemplate"&gt;
      &lt;property name="SessionFactory" ref="hibernateSessionFactory" /&gt;
      &lt;property name="TemplateFlushMode" value="Auto" /&gt;
      &lt;property name="AllowCreate" value="true" /&gt;
      &lt;property name="CacheQueries" value="true" /&gt;
  &lt;/object&gt;
  
  &lt;object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate"&gt;
      &lt;property name="SessionFactory" ref="hibernateSessionFactory" /&gt;
      &lt;property name="TemplateFlushMode" value="Auto" /&gt;
      &lt;property name="AllowCreate" value="true" /&gt;
      &lt;property name="CacheQueries" value="true" /&gt;
  &lt;/object&gt;
  </code></pre>
  
  <p>Of course everything is sanitized and trimmed to reduce space.  I did not change the mapping hbm files because I didn't find anything saying I should.</p>
  
  <p>I knocked Spring logging to DEBUG, fixed a few issues there.  Changing NHibernate to DEBUG doesn't add any logging because it's not getting that far.  Spring loads everything else fine. The hibernate.cfg.xml output DEBUG messages with "Ignoring object class loading failure for object X" all of them saying 
  "Could not load type from string value".
  The first ERROR is "GetObjectInternal: error obtaining object transactionManager".</p>
  
  <p>I've banged my head against the wall for hours trying to figure out why.  I know there are folks out there who understand this stuff better than myself and can point me in the right direction, so here's my call for help.</p>