levis
04-25-2007, 05:08 AM
I newbie in hibernate and test using NUnit 2.4 and i found this error
Dimas2.Dao.NHibernate.Test.HibernateReferenceDaoTe st.deleteReference : System.Configuration.ConfigurationErrorsException : Error instantiating context 'spring.root'.
----> Spring.Objects.FatalObjectException : Cannot instantiate Type [Spring.Context.Support.XmlApplicationContext] using ctor [Void .ctor(System.String, Boolean, System.String[])] : 'Exception has been thrown by the target of an invocation.'
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> Spring.Objects.Factory.ObjectDefinitionStoreExcept ion : Failed parsing object definition '<object id="referenceDao" type="Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate" xmlns="http://www.springframework.net"><property name="SessionFactory" ref="SessionFactory" /></object>'
----> Spring.Objects.Factory.ObjectDefinitionStoreExcept ion : Error registering object with name 'referenceDao' defined in 'file [D:\neo\source\Code2\Dimas2.Dao.NHibernate.Test\bin \Debug\Dao.xml]' : Object class [Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate] not found.
<object id="referenceDao" type="Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate" xmlns="http://www.springframework.net"><property name="SessionFactory" ref="SessionFactory" /></object>
----> System.TypeLoadException : Could not load type from string value 'Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate'.
----> System.TypeLoadException : Could not load type 'Dimas2.Dao.NHibernate.HibernateReferenceDao' from assembly 'Dimas2.Dao.NHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
This is my 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, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter , Common.Logging.Log4Net">
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
<!-- otherwise BasicConfigurer.Configure is used -->
<!-- log4net configuration file is specified with key configFile-->
<arg key="configType" value="EXTERNAL" />
</factoryAdapter>
</logging>
</common>
<spring>
<parsers>
<parser type="Spring.Data.DatabaseConfigParser, Spring.Data" />
</parsers>
<context>
<resource uri="Aspects.xml" />
<resource uri="Services.xml" />
<resource uri="Dao.xml" />
</context>
</spring>
<!-- These properties are referenced in Dao.xml -->
<databaseSettings>
<add key="db.datasource" value="40-MAP\SQLSERVER2005" />
<add key="db.user" value="sa" />
<add key="db.password" value="adminsql" />
<add key="db.database" value="Dimas2" />
</databaseSettings>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level %logger - %message%newline" />
</layout>
</appender>
<!-- Set default logging level to DEBUG -->
<root>
<level value="DEBUG" />
<appender-ref ref="ConsoleAppender" />
</root>
<!-- Set logging for Spring to INFO. Logger names in Spring
correspond to the namespace -->
<!-- Note in this example, the example code uses the logging name
Spring.Examples.MovieFinder.MovieApp -->
<logger name="Spring">
<level value="INFO" />
</logger>
<logger name="Spring.Data">
<level value="INFO" />
</logger>
<logger name="NHibernate">
<level value="INFO" />
</logger>
</log4net>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener , Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
</configuration>
hope somebody could help me
Thanks
Dimas2.Dao.NHibernate.Test.HibernateReferenceDaoTe st.deleteReference : System.Configuration.ConfigurationErrorsException : Error instantiating context 'spring.root'.
----> Spring.Objects.FatalObjectException : Cannot instantiate Type [Spring.Context.Support.XmlApplicationContext] using ctor [Void .ctor(System.String, Boolean, System.String[])] : 'Exception has been thrown by the target of an invocation.'
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> Spring.Objects.Factory.ObjectDefinitionStoreExcept ion : Failed parsing object definition '<object id="referenceDao" type="Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate" xmlns="http://www.springframework.net"><property name="SessionFactory" ref="SessionFactory" /></object>'
----> Spring.Objects.Factory.ObjectDefinitionStoreExcept ion : Error registering object with name 'referenceDao' defined in 'file [D:\neo\source\Code2\Dimas2.Dao.NHibernate.Test\bin \Debug\Dao.xml]' : Object class [Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate] not found.
<object id="referenceDao" type="Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate" xmlns="http://www.springframework.net"><property name="SessionFactory" ref="SessionFactory" /></object>
----> System.TypeLoadException : Could not load type from string value 'Dimas2.Dao.NHibernate.HibernateReferenceDao, Dimas2.Dao.NHibernate'.
----> System.TypeLoadException : Could not load type 'Dimas2.Dao.NHibernate.HibernateReferenceDao' from assembly 'Dimas2.Dao.NHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
This is my 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, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter , Common.Logging.Log4Net">
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
<!-- otherwise BasicConfigurer.Configure is used -->
<!-- log4net configuration file is specified with key configFile-->
<arg key="configType" value="EXTERNAL" />
</factoryAdapter>
</logging>
</common>
<spring>
<parsers>
<parser type="Spring.Data.DatabaseConfigParser, Spring.Data" />
</parsers>
<context>
<resource uri="Aspects.xml" />
<resource uri="Services.xml" />
<resource uri="Dao.xml" />
</context>
</spring>
<!-- These properties are referenced in Dao.xml -->
<databaseSettings>
<add key="db.datasource" value="40-MAP\SQLSERVER2005" />
<add key="db.user" value="sa" />
<add key="db.password" value="adminsql" />
<add key="db.database" value="Dimas2" />
</databaseSettings>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level %logger - %message%newline" />
</layout>
</appender>
<!-- Set default logging level to DEBUG -->
<root>
<level value="DEBUG" />
<appender-ref ref="ConsoleAppender" />
</root>
<!-- Set logging for Spring to INFO. Logger names in Spring
correspond to the namespace -->
<!-- Note in this example, the example code uses the logging name
Spring.Examples.MovieFinder.MovieApp -->
<logger name="Spring">
<level value="INFO" />
</logger>
<logger name="Spring.Data">
<level value="INFO" />
</logger>
<logger name="NHibernate">
<level value="INFO" />
</logger>
</log4net>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceListener , Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
</configuration>
hope somebody could help me
Thanks