bennyb
07-01-2007, 03:44 PM
I downloaded the Spring.Northwind.WinForm example and added all references. When I try to run it, I get a System.Configuration.ConfigurationErrorsException with a message
Error instantiating context 'spring.root'..
The Full error message is shown below:
System.Configuration.ConfigurationErrorsException was unhandled
Message="Error instantiating context 'spring.root'."
Source="System.Configuration"
BareMessage="Error instantiating context 'spring.root'."
Line=0
StackTrace:
at System.Configuration.BaseConfigurationRecord.Evalu ateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evalu ate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey)
at System.Configuration.ClientConfigurationSystem.Sys tem.Configuration.Internal.IInternalConfigSystem.G etSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSecti on(String sectionName)
at Spring.Util.ConfigurationUtils.GetSection(String sectionName)
at Spring.Context.Support.ContextRegistry.InitializeC ontextIfNeeded()
at Spring.Context.Support.ContextRegistry.GetContext( )
at Spring.Northwind.WinForm.Program.Main() in C:\DevMed\Samples\Spring\Spring.Northwind.WinForm\ Program.cs:line 20
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
My Files:
-----------------------------------------------------------------------
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
</sectionGroup>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="parsers" type="Spring.Context.Support.ConfigParsersSectionHandler , Spring.Core"/>
</sectionGroup>
<section name="databaseSettings" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter , Common.Logging.Log4Net129">
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
<!-- otherwise BasicConfigurer.Configure is used -->
<!-- log4net configuration file is specified with key configFile-->
<arg key="configType" value="FILE-WATCH"/>
<arg key="configFile" value="file://~/Log4net.xml"/>
</factoryAdapter>
</logging>
</common>
<spring>
<parsers>
<parser type="Spring.Data.DatabaseConfigParser, Spring.Data"/>
</parsers>
<context>
<resource uri="file://~/WinForm.xml"/>
</context>
</spring>
<!-- These properties are referenced in Dao.xml -->
<databaseSettings>
<add key="connectionString" value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=WHICHMAN-MAYA\SQL2005;"/>
</databaseSettings>
</configuration>
Services.xml
<objects xmlns="http://www.springframework.net">
<!-- Referenced by main application context configuration file -->
<description>
The Northwind service layer definitions
</description>
<!-- Property placeholder configurer for database settings -->
<object id="FulfillmentService" type="Spring.Northwind.Service.FulfillmentService, Spring.Northwind.Service">
<property name="CustomerDao" ref="CustomerDao"/>
<property name="OrderDao" ref="OrderDao"/>
<property name="ShippingService" ref="ShippingService"/>
</object>
<object id="ShippingService" type="Spring.Northwind.Service.FedExShippingService, Spring.Northwind.Service">
</object>
<import resource="DeclarativeServicesAttributeDriven.xml"/>
<!-- didn't configure correctly yet - don't use
<import resource="DeclarativeServicesObjectNameDriven.xml"/>
-->
<!--
<import resource="DeclarativeServicesTxProxyFactoryDriven.xml"/>
-->
</objects>
Dao.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database">
<!-- Referenced by main application context configuration file -->
<description>
The Northwind object definitions for the Data Access Objects.
</description>
<!-- Property placeholder configurer for database settings -->
<object type="Spring.Objects.Factory.Config.PropertyPlaceholderC onfigurer, Spring.Core">
<property name="ConfigSections" value="databaseSettings"/>
</object>
<!-- Database and NHibernate Configuration -->
<db:dbProvider id="DbProvider"
provider="SqlServer-2.0"
connectionString="${connectionString}"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingAssemblies">
<list>
<value>Spring.Northwind.Dao.NHibernate</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2005Dialect"/>
<entry key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
</object>
<object id="HibernateTransactionManager"
type="Spring.Data.NHibernate.HibernateTransactionManager , Spring.Data.NHibernate">
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate">
<property name="SessionFactory" ref="SessionFactory" />
<property name="TemplateFlushMode" value="Auto" />
<property name="CacheQueries" value="true" />
</object>
<!-- Data Access Objects -->
<object id="CustomerDao" type="Spring.Northwind.Dao.NHibernate.HibernateCustomerD ao, Spring.Northwind.Dao.NHibernate">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
<object id="OrderDao" type="Spring.Northwind.Dao.NHibernate.HibernateOrderDao, Spring.Northwind.Dao.NHibernate">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
</objects>
Winform.xml
<objects xmlns="http://www.springframework.net">
<!-- Referenced by main application context configuration file -->
<description>
The Northwind winform layer definitions
</description>
<object id="Form1" type="Spring.Northwind.WinForm.Form1, Spring.Northwind.WinForm">
<property name="CustomerDao" ref="CustomerDao" />
</object>
</objects>
Can anybody please help?
Error instantiating context 'spring.root'..
The Full error message is shown below:
System.Configuration.ConfigurationErrorsException was unhandled
Message="Error instantiating context 'spring.root'."
Source="System.Configuration"
BareMessage="Error instantiating context 'spring.root'."
Line=0
StackTrace:
at System.Configuration.BaseConfigurationRecord.Evalu ateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evalu ate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ctionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSe ction(String configKey)
at System.Configuration.ClientConfigurationSystem.Sys tem.Configuration.Internal.IInternalConfigSystem.G etSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSecti on(String sectionName)
at Spring.Util.ConfigurationUtils.GetSection(String sectionName)
at Spring.Context.Support.ContextRegistry.InitializeC ontextIfNeeded()
at Spring.Context.Support.ContextRegistry.GetContext( )
at Spring.Northwind.WinForm.Program.Main() in C:\DevMed\Samples\Spring\Spring.Northwind.WinForm\ Program.cs:line 20
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
My Files:
-----------------------------------------------------------------------
App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging"/>
</sectionGroup>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="parsers" type="Spring.Context.Support.ConfigParsersSectionHandler , Spring.Core"/>
</sectionGroup>
<section name="databaseSettings" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter , Common.Logging.Log4Net129">
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
<!-- otherwise BasicConfigurer.Configure is used -->
<!-- log4net configuration file is specified with key configFile-->
<arg key="configType" value="FILE-WATCH"/>
<arg key="configFile" value="file://~/Log4net.xml"/>
</factoryAdapter>
</logging>
</common>
<spring>
<parsers>
<parser type="Spring.Data.DatabaseConfigParser, Spring.Data"/>
</parsers>
<context>
<resource uri="file://~/WinForm.xml"/>
</context>
</spring>
<!-- These properties are referenced in Dao.xml -->
<databaseSettings>
<add key="connectionString" value="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=WHICHMAN-MAYA\SQL2005;"/>
</databaseSettings>
</configuration>
Services.xml
<objects xmlns="http://www.springframework.net">
<!-- Referenced by main application context configuration file -->
<description>
The Northwind service layer definitions
</description>
<!-- Property placeholder configurer for database settings -->
<object id="FulfillmentService" type="Spring.Northwind.Service.FulfillmentService, Spring.Northwind.Service">
<property name="CustomerDao" ref="CustomerDao"/>
<property name="OrderDao" ref="OrderDao"/>
<property name="ShippingService" ref="ShippingService"/>
</object>
<object id="ShippingService" type="Spring.Northwind.Service.FedExShippingService, Spring.Northwind.Service">
</object>
<import resource="DeclarativeServicesAttributeDriven.xml"/>
<!-- didn't configure correctly yet - don't use
<import resource="DeclarativeServicesObjectNameDriven.xml"/>
-->
<!--
<import resource="DeclarativeServicesTxProxyFactoryDriven.xml"/>
-->
</objects>
Dao.xml
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
xmlns:db="http://www.springframework.net/database">
<!-- Referenced by main application context configuration file -->
<description>
The Northwind object definitions for the Data Access Objects.
</description>
<!-- Property placeholder configurer for database settings -->
<object type="Spring.Objects.Factory.Config.PropertyPlaceholderC onfigurer, Spring.Core">
<property name="ConfigSections" value="databaseSettings"/>
</object>
<!-- Database and NHibernate Configuration -->
<db:dbProvider id="DbProvider"
provider="SqlServer-2.0"
connectionString="${connectionString}"/>
<object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate">
<property name="DbProvider" ref="DbProvider"/>
<property name="MappingAssemblies">
<list>
<value>Spring.Northwind.Dao.NHibernate</value>
</list>
</property>
<property name="HibernateProperties">
<dictionary>
<entry key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<entry key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2005Dialect"/>
<entry key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
</dictionary>
</property>
</object>
<object id="HibernateTransactionManager"
type="Spring.Data.NHibernate.HibernateTransactionManager , Spring.Data.NHibernate">
<property name="DbProvider" ref="DbProvider"/>
<property name="SessionFactory" ref="SessionFactory"/>
</object>
<object id="HibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate">
<property name="SessionFactory" ref="SessionFactory" />
<property name="TemplateFlushMode" value="Auto" />
<property name="CacheQueries" value="true" />
</object>
<!-- Data Access Objects -->
<object id="CustomerDao" type="Spring.Northwind.Dao.NHibernate.HibernateCustomerD ao, Spring.Northwind.Dao.NHibernate">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
<object id="OrderDao" type="Spring.Northwind.Dao.NHibernate.HibernateOrderDao, Spring.Northwind.Dao.NHibernate">
<property name="HibernateTemplate" ref="HibernateTemplate"/>
</object>
</objects>
Winform.xml
<objects xmlns="http://www.springframework.net">
<!-- Referenced by main application context configuration file -->
<description>
The Northwind winform layer definitions
</description>
<object id="Form1" type="Spring.Northwind.WinForm.Form1, Spring.Northwind.WinForm">
<property name="CustomerDao" ref="CustomerDao" />
</object>
</objects>
Can anybody please help?