Just following the NHibernate example delivered with Spring.NET and only change the table customer to a new table batch in database.
My scenario is:
A web project for the web site.
Create a new project for controller class. With the original example, these classes are put in folder app_code of the website
I can compile the project and the solution successfully. All xml files are modified properly. (replace all name like 'customer' with 'batch') try to run the application, got following error:
The error is because of web.xml file:
<object name="BatchEditController" type="NHibernateBatchEditController" scope="session">
<constructor-arg name="sessionFactory" ref="NHibernateSessionFactory"/>
</object>
Even I add namespace to rhe type type="RRM.Services.Controller.NHibernateBatchEditController", same error will come out.
Help please.
------Error message-----
Server Error in '/' Application.
Could not load type from string value 'NHibernateBatchEditController'.
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.TypeLoadException: Could not load type from string value 'NHibernateBatchEditController'.
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:
[TypeLoadException: Could not load type from string value 'NHibernateBatchEditController'.]
Spring.Core.TypeResolution.TypeResolver.Resolve(String typeName) +288
Spring.Core.TypeResolution.GenericTypeResolver.Resolve(String typeName) +481
Spring.Core.TypeResolution.CachedTypeResolver.Resolve(String typeName) +340
Spring.Core.TypeResolution.TypeResolutionUtils.ResolveType(String typeName) +92
Spring.Objects.Factory.Support.WebObjectDefinitionFactory.CreateObjectDefinition(String typeName, String parent, AppDomain domain) +381
Spring.Objects.Factory.Xml.ObjectsNamespaceParser.ParseObjectDefinition(XmlElement element, String id, ObjectDefinitionParserHelper parserHelper) +492
[ObjectDefinitionStoreException: Error registering object with name 'BatchEditController' defined in 'file [C:\Development\001\RRM\RRM\Web.xml]' : Object class [NHibernateBatchEditController] not found.
<object name="BatchEditController" type="NHibernateBatchEditController" scope="session" xmlns="http://www.springframework.net"><constructor-arg name="sessionFactory" ref="NHibernateSessionFactory" /></object>]
Spring.Objects.Factory.Xml.XmlReaderContext.ReportException(XmlNode node, String name, String message, Exception cause) +420
Spring.Objects.Factory.Xml.ObjectsNamespaceParser.ParseObjectDefinition(XmlElement element, String id, ObjectDefinitionParserHelper parserHelper) +2045
Spring.Objects.Factory.Xml.WebObjectsNamespaceParser.ParseObjectDefinition(XmlElement element, String id, ObjectDefinitionParserHelper parserHelper) +100
Spring.Objects.Factory.Xml.ObjectsNamespaceParser.ParseObjectDefinition(XmlElement element, ParserContext parserContext) +312
Spring.Objects.Factory.Xml.ObjectsNamespaceParser.RegisterObjectDefinition(XmlElement element, ParserContext parserContext) +81
[ObjectDefinitionStoreException: Failed parsing object definition '<object name="BatchEditController" type="NHibernateBatchEditController" scope="session" xmlns="http://www.springframework.net"><constructor-arg name="sessionFactory" ref="NHibernateSessionFactory" /></object>']
Spring.Objects.Factory.Xml.ObjectsNamespaceParser.RegisterObjectDefinition(XmlElement element, ParserContext parserContext) +194
Spring.Objects.Factory.Xml.ObjectsNamespaceParser.ParseElement(XmlElement element, ParserContext parserContext) +268
Spring.Objects.Factory.Xml.DefaultObjectDefinitionDocumentReader.ParseObjectDefinitions(XmlElement root, ObjectDefinitionParserHelper helper) +304
Spring.Objects.Factory.Xml.DefaultObjectDefinitionDocumentReader.RegisterObjectDefinitions(XmlDocument doc, XmlReaderContext readerContext) +167
Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.RegisterObjectDefinitions(XmlDocument doc, IResource resource) +120
Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.DoLoadObjectDefinitions(Stream stream, IResource resource) +317
[ObjectDefinitionStoreException: Unexpected exception parsing XML document from file [C:\Development\001\RRM\RRM\Web.xml]]
Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.DoLoadObjectDefinitions(Stream stream, IResource resource) +480
Spring.Objects.Factory.Xml.XmlObjectDefinitionReader.LoadObjectDefinitions(IResource resource) +319
Spring.Objects.Factory.Support.AbstractObjectDefinitionReader.LoadObjectDefinitions(String location) +297
Spring.Objects.Factory.Support.AbstractObjectDefinitionReader.LoadObjectDefinitions(String[] locations) +129
Spring.Context.Support.AbstractXmlApplicationContext.LoadObjectDefinitions(XmlObjectDefinitionReader objectDefinitionReader) +111
Spring.Context.Support.AbstractXmlApplicationContext.LoadObjectDefinitions(DefaultListableObjectFactory objectFactory) +101
Spring.Context.Support.AbstractXmlApplicationContext.RefreshObjectFactory() +147
Spring.Context.Support.AbstractApplicationContext.Refresh() +146
Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations) +96
Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, String[] configurationLocations) +55
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) +0
System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) +13
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +366
System.Reflection.ConstructorInfo.Invoke(Object[] parameters) +14
Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) +671
[FatalReflectionException: Cannot instantiate Type [Spring.Context.Support.WebApplicationContext] using ctor [Void .ctor(System.String, Boolean, System.String[])] : 'Exception has been thrown by the target of an invocation.']
Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) +882
Spring.Context.Support.RootContextInstantiator.InvokeContextConstructor(ConstructorInfo ctor) +198
Spring.Context.Support.ContextInstantiator.InstantiateContext() +190
Spring.Context.Support.ContextHandler.InstantiateContext(IApplicationContext parentContext, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +191
Spring.Context.Support.WebContextHandler.InstantiateContext(IApplicationContext parent, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +369
Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section) +513
[ConfigurationErrorsException: Error creating context 'spring.root': Could not load type from string value 'NHibernateBatchEditController'.]
System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) +178
System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) +896
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) +1221
System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) +56
System.Configuration.BaseConfigurationRecord.GetSection(String configKey) +8
System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey) +65
System.Configuration.ConfigurationManager.GetSection(String sectionName) +107
Spring.Util.ConfigurationUtils.GetSection(String sectionName) +44
Spring.Context.Support.WebApplicationContext.GetContextInternal(String virtualPath) +1081
Spring.Context.Support.WebApplicationContext.GetRootContext() +132
Spring.Context.Support.WebSupportModule.Init(HttpApplication app) +447
System.Web.HttpApplication.InitModulesCommon() +66
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +814
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +243
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +106
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +340
|