Hello,
since last night we have a strange problem on loading an object instance by session.Get/Load (see below). It only occures for some dataobjects (DoWfInstance, DoWfNode).
Strangely for class DoWfNode but not for class DoWfTimerInstance which is derived from DoWfNode (see hbm)
As I know nothing relevant has changed(?), it's a big project with several developers...
Tasks I have already tried:
cleanup solution
rebuild all
delete solution
getting new from source safe
resetting of all references for nhibernate related dlls/projects (nhibernate, generics ...)
included nhibernate in debug mode: Error occures in NHibernate.Proxy.CastleProxyFactory#58:
_proxyGenerator.CreateClassProxy( _persistentClass, _interfaces, initializer, false );
Code:
/// <summary>
/// Build a proxy using the Castle.DynamicProxy library.
/// </summary>
/// <param name="id">The value for the Id.</param>
/// <param name="session">The Session the proxy is in.</param>
/// <returns>A fully built <c>INHibernateProxy</c>.</returns>
public INHibernateProxy GetProxy( object id, ISessionImplementor session )
{
try
{
CastleLazyInitializer initializer = new CastleLazyInitializer( _persistentClass, id,
_getIdentifierMethod, _setIdentifierMethod, session );
object generatedProxy = null;
if( IsClassProxy )
{
generatedProxy = _proxyGenerator.CreateClassProxy( _persistentClass, _interfaces, initializer, false ); // ERROR is raised here !!!
}
else
{
generatedProxy = _proxyGenerator.CreateProxy( _interfaces, initializer, new object() );
}
initializer._constructed = true;
return ( INHibernateProxy ) generatedProxy;
}
catch( Exception e )
{
log.Error( "Creating a proxy instance failed", e );
throw new HibernateException( "Creating a proxy instance failed", e );
}
}
Hibernate version: 1.0.2, DotNet. 2.0, we use Nhibernate.Generics Code between sessionFactory.openSession() and session.close():session.Get(typeof(DoWfInstance), (long)173)
Full stack trace of any exception that occurs:NHibernate: SELECT dowfinstan0_.idWfInstance as idWfInst1_1_, dowfinstan0_.idWorkflowObject as idWorkfl8_1_, dowfinstan0_.idCreatedBy as idCreat12_1_, dowfinstan0_.idState as idState1_, dowfinstan0_.OState as OState1_, dowfinstan0_.idChangedBy as idChang13_1_, dowfinstan0_.idDefinition as idDefin10_1_, dowfinstan0_.Version as Version1_, dowfinstan0_.ErrorWorkflowInstanceId as ErrorWor5_1_, dowfinstan0_.idParent as idParent1_, dowfinstan0_.WorkflowInstanceId as Workflow4_1_, dowfinstan0_.CreateDate as CreateDate1_, dowfinstan0_.ChangeDate as ChangeDate1_, dowfmilest1_.idWfMilestonePlan as idWfMile1_0_, dowfmilest1_.ChangeDate as ChangeDate0_, dowfmilest1_.OState as OState0_, dowfmilest1_.idObject as idObject0_, dowfmilest1_.idDefinition as idDefini7_0_, dowfmilest1_.Version as Version0_, dowfmilest1_.idCreatedBy as idCreat10_0_, dowfmilest1_.idInstance as idInstance0_, dowfmilest1_.CreateDate as CreateDate0_, dowfmilest1_.Completed as Completed0_, dowfmilest1_.idChangedBy as idChang11_0_ FROM WfInstance dowfinstan0_ left outer join WfMilestonePlan dowfmilest1_ on dowfinstan0_.idWfInstance=dowfmilest1_.idInstance WHERE dowfinstan0_.idWfInstance=@p0
@p0 = '173'
: EXCEPTION
Exception initializing proxy: [DoWfInstance#173]
at NHibernate.Proxy.LazyInitializer.InitializeWrapExceptions()
at NHibernate.Proxy.CastleLazyInitializer.Intercept(IInvocation invocation, Object[] args)
at CProxyTypeDoWfInstanceWorkflowEngine_INHibernateProxy1.ToString()
at System.IO.TextWriter.WriteLine(Object value)
at System.IO.TextWriter.SyncTextWriter.WriteLine(Object value)
at System.Console.WriteLine(Object value)
at Upper.S3.Core.Test.NHibernateTest.TempTest1() in D:\_work\S3\src\S3.root\S3\UnitTests\Core.Test\NHibernate.Test.cs:line 241
Creating a proxy instance failed
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)
at NHibernate.Persister.AbstractEntityPersister.CreateProxy(Object id, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation)
at NHibernate.Impl.SessionImpl.InternalLoad(Type clazz, Object id)
at NHibernate.Type.ManyToOneType.ResolveIdentifier(Object id, ISessionImplementor session)
at NHibernate.Type.EntityType.ResolveIdentifier(Object id, ISessionImplementor session, Object owner)
at NHibernate.Impl.SessionImpl.InitializeEntity(Object obj)
at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies)
at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId)
at NHibernate.Loader.EntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject)
at NHibernate.Persister.EntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session)
at NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted)
at NHibernate.Impl.SessionImpl.ImmediateLoad(Type clazz, Object id)
at NHibernate.Proxy.LazyInitializer.Initialize()
at NHibernate.Proxy.LazyInitializer.InitializeWrapExceptions()
Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxyInstance(Type type, IInterceptor interceptor, Object[] argumentsForConstructor)
at Castle.DynamicProxy.ProxyGenerator.CreateClassProxy(Type baseClass, Type[] interfaces, IInterceptor interceptor, Boolean checkAbstract, Object[] argumentsForConstructor)
at NHibernate.Proxy.CastleProxyFactory.GetProxy(Object id, ISessionImplementor session)
Es wurde versucht, eine Datei mit einem falschen Format zu laden. (Exception from HRESULT: 0x8007000B)
at CProxyTypeDoWorkflowObjectCore_INHibernateProxy1..ctor(IInterceptor )
Mapping documents:Code:
<class lazy="true" name="Upper.S3.DataObjects.WorkflowEngine.DoWfInstance,UPPER.S3.DataObjects" table="WfInstance">
<id name="Id" column="idWfInstance" access="nosetter.camelcase-underscore" type="Int64" unsaved-value="0">
<generator class="native"/>
</id>
<version name="Version" column="Version" type="Int32" access="property" unsaved-value="undefined"/>
<property column="OState" access="nosetter.camelcase-underscore" not-null="true" type="Int32" name="OState"/>
<property column="WorkflowInstanceId" not-null="true" type="Guid" name="WorkflowInstanceId" />
<property column="ErrorWorkflowInstanceId" not-null="true" type="Guid" name="ErrorWorkflowInstanceId" />
<property column="CreateDate" not-null="true" type="DateTime" name="CreateDate" />
<property column="ChangeDate" not-null="true" type="DateTime" name="ChangeDate" />
<many-to-one name="WorkflowObject" column="idWorkflowObject" not-null="true" class="Upper.S3.DataObjects.Core.DoWorkflowObject,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<set name="ProcessNodes" cascade="none" lazy="true" inverse="true" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">*</meta>
<key column="idWorkflowInstance" />
<one-to-many class="Upper.S3.DataObjects.WorkflowEngine.Nodes.DoWfProcessNode,UPPER.S3.DataObjects"/>
</set>
<one-to-one name="MilestonePlan" class="Upper.S3.DataObjects.WorkflowEngine.DoWfMilestonePlan,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" property-ref="Instance">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">1</meta>
</one-to-one>
<many-to-one name="State" column="idState" not-null="true" class="Upper.S3.DataObjects.WorkflowEngine.DoWfInstanceState,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="Definition" column="idDefinition" not-null="true" class="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWorkflowDefinition,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="Parent" column="idParent" not-null="false" class="Upper.S3.DataObjects.WorkflowEngine.DoWfInstance,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<set name="Children" cascade="none" lazy="true" inverse="true" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">*</meta>
<key column="idParent" />
<one-to-many class="Upper.S3.DataObjects.WorkflowEngine.DoWfInstance,UPPER.S3.DataObjects"/>
</set>
<set name="Nodes" cascade="none" lazy="true" inverse="true" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">*</meta>
<key column="idInstance" />
<one-to-many class="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWfNode,UPPER.S3.DataObjects"/>
</set>
<many-to-one name="CreatedBy" column="idCreatedBy" not-null="true" class="Upper.S3.DataObjects.Core.Security.DoUser,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="ChangedBy" column="idChangedBy" not-null="true" class="Upper.S3.DataObjects.Core.Security.DoUser,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
</class>
<class lazy="true" name="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWfNode,UPPER.S3.DataObjects" table="WfNode" discriminator-value="WfNode">
<id name="Id" column="idWfNode" access="nosetter.camelcase-underscore" type="Int64" unsaved-value="0">
<generator class="native"/>
</id>
<discriminator column="Discriminator" type="String"/>
<version name="Version" column="Version" type="Int32" access="property" unsaved-value="undefined"/>
<property column="OState" access="nosetter.camelcase-underscore" not-null="true" type="Int32" name="OState"/>
<property column="ActivityId" not-null="true" type="Guid" name="ActivityId" />
<property column="ExecutionOrder" not-null="true" type="Int32" name="ExecutionOrder" />
<property column="CreateDate" not-null="true" type="DateTime" name="CreateDate" />
<property column="ChangeDate" not-null="true" type="DateTime" name="ChangeDate" />
<set name="Results" cascade="none" lazy="true" inverse="true" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">*</meta>
<key column="idNode" />
<one-to-many class="Upper.S3.DataObjects.WorkflowEngine.DoWfNodeResult,UPPER.S3.DataObjects"/>
</set>
<set name="AuditEntryDefinitions" cascade="none" lazy="true" inverse="true" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">*</meta>
<key column="idNodeDefinition" />
<one-to-many class="Upper.S3.DataObjects.Core.DoAuditEntryDefinition,UPPER.S3.DataObjects"/>
</set>
<one-to-one name="UISetting" class="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWfNodeUISetting,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" property-ref="Node">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</one-to-one>
<many-to-one name="State" column="idState" not-null="false" class="Upper.S3.DataObjects.WorkflowEngine.DoWfNodeState,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="Instance" column="idInstance" not-null="false" class="Upper.S3.DataObjects.WorkflowEngine.DoWfInstance,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="Definition" column="idDefinition" not-null="true" class="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWfNodeDefinition,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="Parent" column="idParent" not-null="false" class="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWfNode,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<set name="Children" cascade="none" lazy="true" inverse="true" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">0</meta>
<meta attribute="MultiplicityMax">*</meta>
<key column="idParent" />
<one-to-many class="Upper.S3.DataObjects.WorkflowEngine.Nodes.Definitions.DoWfNode,UPPER.S3.DataObjects"/>
</set>
<many-to-one name="CreatedBy" column="idCreatedBy" not-null="true" class="Upper.S3.DataObjects.Core.Security.DoUser,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<many-to-one name="ChangedBy" column="idChangedBy" not-null="true" class="Upper.S3.DataObjects.Core.Security.DoUser,UPPER.S3.DataObjects" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics">
<meta attribute="MultiplicityMin">1</meta>
<meta attribute="MultiplicityMax">1</meta>
</many-to-one>
<subclass lazy="true" name="Upper.S3.DataObjects.WorkflowEngine.DoWfTimerInstance,UPPER.S3.DataObjects" discriminator-value="WfTimerInstance">
<property column="CompletionTime" not-null="false" type="DateTime" name="CompletionTime" />
<property column="Duration" not-null="true" type="Int64" name="Duration" />
<property column="IsTimeout" not-null="true" type="Boolean" name="IsTimeout" />
<property column="StartTime" not-null="true" type="DateTime" name="StartTime" />
<property column="IsMilestone" not-null="true" type="Boolean" name="IsMilestone" />
<property column="AllStopsRequired" not-null="true" type="Boolean" name="AllStopsRequired" />
<property column="ExpireDate" not-null="false" type="DateTime" name="ExpireDate" />
<property column="ExpireCount" not-null="true" type="Int32" name="ExpireCount" />
</subclass>
</class>