首页 新闻 会员 周边

spring.net与Nhibernate问题

0
悬赏园豆:50 [已解决问题] 解决于 2012-07-16 17:55

“/”应用程序中的服务器错误。


 

Could not load type from string value 'DirectCenter.DAL.UserDao, DirectCenter.DAL'.

说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 
异常详细信息: System.TypeLoadException: Could not load type from string value 'DirectCenter.DAL.UserDao, DirectCenter.DAL'.
源错误: 

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

堆栈跟踪: 

[TypeLoadException: Could not load type from string value 'DirectCenter.DAL.UserDao, DirectCenter.DAL'.]
   Spring.Core.TypeResolution.TypeResolver.Resolve(String typeName) +224
   Spring.Core.TypeResolution.GenericTypeResolver.Resolve(String typeName) +309
   Spring.Core.TypeResolution.CachedTypeResolver.Resolve(String typeName) +229
   Spring.Core.TypeResolution.TypeResolutionUtils.ResolveType(String typeName) +41
   Spring.Objects.Factory.Support.AbstractObjectDefinition.ResolveObjectType() +35
   Spring.Objects.Factory.Support.AbstractObjectFactory.ResolveObjectType(RootObjectDefinition rod, String objectName) +71

[CannotLoadObjectTypeException: Cannot resolve type [DirectCenter.DAL.UserDao, DirectCenter.DAL] for object with name 'UserDao' defined in assembly [DirectCenter.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], resource [DirectCenter.App.Dao.xml]]
   Spring.Objects.Factory.Support.AbstractObjectFactory.ResolveObjectType(RootObjectDefinition rod, String objectName) +137
   Spring.Objects.Factory.Support.DefaultListableObjectFactory.PreInstantiateSingletons() +267
   Spring.Context.Support.AbstractApplicationContext.Refresh() +512
   Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations) +66
   Spring.Context.Support.WebApplicationContext..ctor(String name, Boolean caseSensitive, String[] configurationLocations) +17

[TargetInvocationException: 调用的目标发生了异常。]
   System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType) +0
   System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType) +15
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +249
   Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) +229

[FatalReflectionException: Cannot instantiate Type [Spring.Context.Support.WebApplicationContext] using ctor [Void .ctor(System.String, Boolean, System.String[])] : '调用的目标发生了异常。']
   Spring.Util.ObjectUtils.InstantiateType(ConstructorInfo constructor, Object[] arguments) +378
   Spring.Context.Support.RootContextInstantiator.InvokeContextConstructor(ConstructorInfo ctor) +108
   Spring.Context.Support.ContextInstantiator.InstantiateContext() +34
   Spring.Context.Support.ContextHandler.InstantiateContext(IApplicationContext parentContext, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +106
   Spring.Context.Support.WebContextHandler.InstantiateContext(IApplicationContext parent, Object configContext, String contextName, Type contextType, Boolean caseSensitive, String[] resources) +268
   Spring.Context.Support.ContextHandler.Create(Object parent, Object configContext, XmlNode section) +265

[ConfigurationErrorsException: Error creating context 'spring.root': Could not load type from string value 'DirectCenter.DAL.UserDao, DirectCenter.DAL'.]
   System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) +202
   System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) +1061
   System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) +1431
   System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) +56
   System.Configuration.BaseConfigurationRecord.GetSection(String configKey) +8
   System.Web.HttpContext.GetSection(String sectionName) +47
   System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName) +39
   System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey) +6
   System.Configuration.ConfigurationManager.GetSection(String sectionName) +78
   Spring.Util.ConfigurationUtils.GetSection(String sectionName) +50
   Spring.Context.Support.WebApplicationContext.GetContextInternal(String virtualPath) +829
   Spring.Context.Support.WebApplicationContext.GetRootContext() +84
   Spring.Context.Support.WebSupportModule.Init(HttpApplication app) +372
   System.Web.HttpApplication.InitModulesCommon() +65
   System.Web.HttpApplication.InitModules() +43
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289

版本信息: Microsoft .NET Framework 版本:2.0.50727.4971; ASP.NET 版本:2.0.50727.4971

因为这个刚接触,具体不知道该怎么说。这个问题是我在用HibernateTemplate注入到数据访问类中的时候出错

qqmamiao的主页 qqmamiao | 初学一级 | 园豆:146
提问于:2012-07-16 16:13
< >
分享
最佳答案
1

DirectCenter.DAL.dll这个文件在bin文件中有吗?

收获园豆:50
dudu | 高人七级 |园豆:31003 | 2012-07-16 17:31

谢谢,的确是这个问题,因为这个练习时根据别人的做的,没注意

qqmamiao | 园豆:146 (初学一级) | 2012-07-16 17:54

今天我也遇到同样的问题,解决了,就是DLL没在文件夹中的事。。。

AaronYu | 园豆:200 (初学一级) | 2013-08-22 17:05
其他回答(1)
0

我也遇到了这个问题 百思不得解

luenshan | 园豆:202 (菜鸟二级) | 2012-09-14 12:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册