Hi,
I am using NHibernate 3.0 and i am using it to connect to SQL server
2008 database. I am running into a strange issue where i get the error
"Creating a proxy instance failed" intermittently. Its not happening
consistently. I am able to complete the operations successfully
sometimes and on some occasions i get the following error.

Any help of this would be really great. Please let me know if you need
any additional information.

Thanks,
Karthik

2011-06-03 17:56:18.673 /LM/W3SVC/1/ROOT/CIM-1-129516153386330226
2300:2 CSG.ACPx.CIM.Adapter
RetrieveCustomer
EXCEPTION (LEVEL 1): NHibernate.HibernateException
EXCEPTION OUTPUT: Creating a proxy instance failed

STACK TRACE:
   at NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate.ByteCode.Castle\ProxyFactory.cs:line 44
   at
NHibernate.Tuple.Entity.AbstractEntityTuplizer.CreateProxy(Object id,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Tuple\Entity\AbstractEntityTuplizer.cs:line 236
   at
NHibernate.Event.Default.DefaultLoadEventListener.CreateProxyIfNecessary(LoadEvent
event, IEntityPersister persister, EntityKey keyToLoad, LoadType
options, IPersistenceContext persistenceContext) in d:\CSharp\NH\NH
\nhibernate\src\NHibernate\Event\Default
\DefaultLoadEventListener.cs:line 224
   at
NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad(LoadEvent
event, IEntityPersister persister, EntityKey keyToLoad, LoadType
options) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\Default
\DefaultLoadEventListener.cs:line 155
   at
NHibernate.Event.Default.DefaultLoadEventListener.OnLoad(LoadEvent
event, LoadType loadType) in d:\CSharp\NH\NH\nhibernate\src\NHibernate
\Event\Default\DefaultLoadEventListener.cs:line 87
   at NHibernate.Impl.SessionImpl.FireLoad(LoadEvent event, LoadType
loadType) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Impl
\SessionImpl.cs:line 2466
   at NHibernate.Impl.SessionImpl.InternalLoad(String entityName,
Object id, Boolean eager, Boolean isNullable) in d:\CSharp\NH\NH
\nhibernate\src\NHibernate\Impl\SessionImpl.cs:line 1376
   at NHibernate.Type.EntityType.ResolveIdentifier(Object id,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Type\EntityType.cs:line 396
   at NHibernate.Engine.TwoPhaseLoad.InitializeEntity(Object entity,
Boolean readOnly, ISessionImplementor session, PreLoadEvent
preLoadEvent, PostLoadEvent postLoadEvent) in d:\CSharp\NH\NH
\nhibernate\src\NHibernate\Engine\TwoPhaseLoad.cs:line 79
   at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList
hydratedObjects, Object resultSetId, ISessionImplementor session,
Boolean readOnly) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Loader
\Loader.cs:line 601
   at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies) in d:\CSharp\NH
\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 474
   at
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies) in d:
\CSharp\NH\NH\nhibernate\src\NHibernate\Loader\Loader.cs:line 243
   at NHibernate.Loader.Loader.LoadCollection(ISessionImplementor
session, Object id, IType type) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Loader\Loader.cs:line 1514
   at
NHibernate.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection(InitializeCollectionEvent
event) in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Event\Default
\DefaultInitializeCollectionEventListener.cs:line 52
   at
NHibernate.Impl.SessionImpl.InitializeCollection(IPersistentCollection
collection, Boolean writing) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate\Impl\SessionImpl.cs:line 1588
   at
NHibernate.Collection.Generic.PersistentGenericBag`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Collection\Generic
\PersistentGenericBag.cs:line 143
   at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()
   at
CSG.ACPx.CIM.CIMAdapter.CustomerEntity.Translation.ContactMethodCollectionMapping.MapToDataContract(IList`1
entity) in C:\Source\trunk\CIM\Src\Adapters\CSG.ACPx.CIM.CIMAdapter
\CustomerEntity\Translation\ContactMethodCollectionMapping.cs:line 57
   at
CSG.ACPx.CIM.CIMAdapter.CustomerEntity.Translation.ContactMapping.MapToDataContract(ContactDTO
entity) in C:\Source\trunk\CIM\Src\Adapters\CSG.ACPx.CIM.CIMAdapter
\CustomerEntity\Translation\ContactMapping.cs:line 89
   at
CSG.ACPx.CIM.CIMAdapter.CustomerEntity.Translation.ContactCollectionMapping.MapToDataContract(IList`1
entity) in C:\Source\trunk\CIM\Src\Adapters\CSG.ACPx.CIM.CIMAdapter
\CustomerEntity\Translation\ContactCollectionMapping.cs:line 65
   at
CSG.ACPx.CIM.CIMAdapter.CustomerEntity.Translation.CustomerMapping.MapToDataContract(CustomerDTO
entity) in C:\Source\trunk\CIM\Src\Adapters\CSG.ACPx.CIM.CIMAdapter
\CustomerEntity\Translation\CustomerMapping.cs:line 148
   at
CSG.ACPx.CIM.CIMAdapter.CustomerEntity.CustomerRepository.RetrieveCustomer(String
externalCustomerId) in C:\Source\trunk\CIM\Src\Adapters
\CSG.ACPx.CIM.CIMAdapter\CustomerEntity\CustomerRepository.cs:line 311
   at
CSG.ACPx.CIM.CIMAdapter.CustomerManagementAdapter.RetrieveCustomer(RetrieveCustomerRequest
request) in C:\Source\trunk\CIM\Src\Adapters\CSG.ACPx.CIM.CIMAdapter
\CustomerManagementAdapter.cs:line 242
   at
Castle.Proxies.Invocations.ICustomerManagementAdapter_RetrieveCustomer.InvokeMethodOnTarget()
   at Castle.DynamicProxy.AbstractInvocation.Proceed() in e:\OSS.Code
\Castle.Core\src\Castle.Core\DynamicProxy\AbstractInvocation.cs:line
144
   at
CSG.ACPx.CIM.Core.Interceptors.AdapterActivityDetailLoggingInterceptor.Intercept(IInvocation
invocation) in C:\Source\trunk\CIM\Src\CSG.ACPx.CIM.Core\Interceptors
\AdapterActivityDetailLoggingInterceptor.cs:line 32
-----------------------------------

EXCEPTION (LEVEL 2): System.InvalidCastException
EXCEPTION OUTPUT: Unable to cast COM object of type
'System.__ComObject' to interface type
'Microsoft.Runtime.Hosting.IClrStrongName'. This operation failed
because the QueryInterface call on the COM component for the interface
with IID '{9FD93CCF-3280-4391-B3A9-96E1CDE77C8D}' failed due to the
following error: Interface not registered (Exception from HRESULT:
0x80040155).

STACK TRACE:
   at
Microsoft.Runtime.Hosting.IClrStrongName.StrongNameGetPublicKey(String
pwzKeyContainer, Byte[] pbKeyBlob, Int32 cbKeyBlob, IntPtr&
ppbPublicKeyBlob, Int32& pcbPublicKeyBlob)
   at
Microsoft.Runtime.Hosting.StrongNameHelpers.StrongNameGetPublicKey(String
pwzKeyContainer, Byte[] bKeyBlob, Int32 cbKeyBlob, IntPtr&
ppbPublicKeyBlob, Int32& pcbPublicKeyBlob)
   at System.Reflection.StrongNameKeyPair.ComputePublicKey()
   at System.Reflection.StrongNameKeyPair.get_PublicKey()
   at System.Reflection.Emit.AssemblyBuilder..ctor(AppDomain domain,
AssemblyName name, AssemblyBuilderAccess access, String dir, Evidence
evidence, PermissionSet requiredPermissions, PermissionSet
optionalPermissions, PermissionSet refusedPermissions, StackCrawlMark&
stackMark, IEnumerable`1 unsafeAssemblyAttributes,
SecurityContextSource securityContextSource)
   at
System.Reflection.Emit.AssemblyBuilder.InternalDefineDynamicAssembly(AssemblyName
name, AssemblyBuilderAccess access, String dir, Evidence evidence,
PermissionSet requiredPermissions, PermissionSet optionalPermissions,
PermissionSet refusedPermissions, StackCrawlMark& stackMark,
IEnumerable`1 unsafeAssemblyAttributes, SecurityContextSource
securityContextSource)
   at System.AppDomain.InternalDefineDynamicAssembly(AssemblyName
name, AssemblyBuilderAccess access, String dir, Evidence evidence,
PermissionSet requiredPermissions, PermissionSet optionalPermissions,
PermissionSet refusedPermissions, StackCrawlMark& stackMark,
IEnumerable`1 assemblyAttributes, SecurityContextSource
securityContextSource)
   at System.AppDomain.DefineDynamicAssembly(AssemblyName name,
AssemblyBuilderAccess access)
   at Castle.DynamicProxy.ModuleScope.CreateModule(Boolean
signStrongName) in e:\OSS.Code\Castle.Core\src\Castle.Core\DynamicProxy
\ModuleScope.cs:line 358
   at
Castle.DynamicProxy.ModuleScope.ObtainDynamicModuleWithStrongName() in
e:\OSS.Code\Castle.Core\src\Castle.Core\DynamicProxy
\ModuleScope.cs:line 297
   at
Castle.DynamicProxy.Generators.Emitters.ClassEmitter..ctor(ModuleScope
modulescope, String name, Type baseType, IEnumerable`1 interfaces,
TypeAttributes flags, Boolean forceUnsigned) in e:\OSS.Code\Castle.Core
\src\Castle.Core\DynamicProxy\Generators\Emitters\ClassEmitter.cs:line
37
   at
Castle.DynamicProxy.Generators.BaseProxyGenerator.BuildClassEmitter(String
typeName, Type parentType, IEnumerable`1 interfaces) in e:\OSS.Code
\Castle.Core\src\Castle.Core\DynamicProxy\Generators
\BaseProxyGenerator.cs:line 117
   at
Castle.DynamicProxy.Generators.ClassProxyGenerator.GenerateType(String
name, Type[] interfaces, INamingScope namingScope) in e:\OSS.Code
\Castle.Core\src\Castle.Core\DynamicProxy\Generators
\ClassProxyGenerator.cs:line 72
   at
Castle.DynamicProxy.Generators.BaseProxyGenerator.ObtainProxyType(CacheKey
cacheKey, Func`3 factory) in e:\OSS.Code\Castle.Core\src\Castle.Core
\DynamicProxy\Generators\BaseProxyGenerator.cs:line 395
   at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type
classToProxy, Type[] additionalInterfacesToProxy,
ProxyGenerationOptions options, Object[] constructorArguments,
IInterceptor[] interceptors) in e:\OSS.Code\Castle.Core\src\Castle.Core
\DynamicProxy\ProxyGenerator.cs:line 1341
   at NHibernate.ByteCode.Castle.ProxyFactory.GetProxy(Object id,
ISessionImplementor session) in d:\CSharp\NH\NH\nhibernate\src
\NHibernate.ByteCode.Castle\ProxyFactory.cs:line 36
-----------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to