These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: DynamicProxyGen exception
PostPosted: Mon Feb 25, 2008 11:02 am 
Newbie

Joined: Mon Feb 25, 2008 10:39 am
Posts: 1
Hi Guys,

I'm pretty new with NHib. so bare with me.
I'm trying to run a proof of concept project with Hniber. for Data layer and WCF for transport layer to business layer.

I'm dealing with a very starnge exception, when building NHibernate persistence objects (with reflection) in business layers.

<ApplicationData>System.IO.FileNotFoundException: Could not load file or assembly 'DynamicAssemblyProxyGen, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'DynamicAssemblyProxyGen, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

Server stack trace:
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.ResolveDataContractInSharedTypeMode(String assemblyName, String typeName, Assembly& assembly, Type& type)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at ReadEmployeeFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )
at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, Int32 declaredTypeID, Type declaredType, String name, String ns)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, String name, String ns)
at System.Runtime.Serialization.NetDataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)
at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Here is a sample of my WCF client :
Business.Objects.Claim c = client.GetClaim(Guid.NewGuid(), null);
client.SelectNHiberEmployee(1, null, null);
Business.Objects.Employee e2 = (new ContactManagerClien()).SelectNHiberEmployee(2, null, null);
e2.LastName = DateTime.Now.ToString();
client.SaveNHiberEmployee(e2);


Mapping file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="ECX.Business.Objects" assembly="BusinessObjects">

<class name="Employee" table="Employees">
<id name="Id" column="EmployeeId" type="long" unsaved-value="-1"
access="field.camelcase-underscore">
<generator class="native" />
</id>

<property name="LastName" column="LastName" type="string" length="20"
not-null="true" access="field.camelcase-underscore"/>

<property name="FirstName" column="FirstName" type="string" length="10"
not-null="true" access="field.camelcase-underscore"/>

<property name="Title" column="Title" type="string" length="30"
access="field.camelcase-underscore"/>

<property name="TitleOfCourtesy" column="TitleOfCourtesy" type="string" length="25"
access="field.camelcase-underscore"/>

<property name="BirthDate" column="BirthDate" type="DateTime"
access="field.camelcase-underscore"/>

<property name="HireDate" column="HireDate" type="DateTime"
access="field.camelcase-underscore"/>

<component name="Address" class="ECX.Business.Objects.Address, BusinessObjects"
access="field.camelcase-underscore" insert="true" update="true">

<property name="Street" column="Address" type="string" length="60"
access="field.camelcase-underscore"/>

<property name="City" column="City" type="string" length="15"
access="field.camelcase-underscore"/>

<property name="Region" column="Region" type="string" length="15"
access="field.camelcase-underscore"/>

<property name="PostalCode" column="PostalCode" type="string" length="10"
access="field.camelcase-underscore"/>

<property name="Country" column="Country" type="string" length="15"
access="field.camelcase-underscore"/>

<property name="PhoneNumber" column="HomePhone" type="string" length="24"
access="field.camelcase-underscore"/>

</component>

<property name="Extension" column="Extension" type="string" length="4"
access="field.camelcase-underscore"/>

<property name="Notes" column="Notes" type="string"
access="field.camelcase-underscore"/>



<many-to-one name="Superior" class="Employee" column="ReportsTo"
access="field.camelcase-underscore" fetch="select"/>


<set name="Orders" access="field.camelcase-underscore"
cascade="save-update" lazy="false">
<key column="EmployeeId"/>
<one-to-many class="Order"/>
</set>



</class>

</hibernate-mapping>


Presistence object:
namespace ECX.Business.Objects
{
[DataContract]
[KnownType(typeof(Iesi.Collections.Generic.HashedSet<Employee>))]
[KnownType(typeof(Item))]
[KnownType(typeof(Address))]

public class Employee : NEntity<Employee>
{

private ICollection<Order> _orders;


private Address _address;
private DateTime? _birthDate;
private string _extension;
private string _firstName;
private DateTime? _hireDate;
private string _lastName;
private string _notes;
private Employee _superior;
private string _title;
private string _titleOfCourtesy;

public Employee()
: this(null, null)
{
}

public Employee(string firstName, string lastName)
{
_firstName = firstName;
_lastName = lastName;


}

[DataMember]
public virtual string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
[DataMember]
public virtual string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
[DataMember]
public virtual string Title
{
get { return _title; }
set { _title = value; }
}
[DataMember]
public virtual string TitleOfCourtesy
{
get { return _titleOfCourtesy; }
set { _titleOfCourtesy = value; }
}
[DataMember]
public virtual DateTime? BirthDate
{
get { return _birthDate; }
set { _birthDate = value; }
}
[DataMember]
public virtual DateTime? HireDate
{
get { return _hireDate; }
set { _hireDate = value; }
}
[DataMember]
public virtual Address Address
{
get { return _address; }
set { _address = value; }
}
[DataMember]
public virtual string Extension
{
get { return _extension; }
set { _extension = value; }
}
[DataMember]
public virtual string Notes
{
get { return _notes; }
set { _notes = value; }
}
[DataMember]
public virtual Employee Superior
{
get { return _superior; }
set { _superior = value; }
}

[DataMember]
public virtual ICollection<Order> Orders
{
get { return _orders; }
set { _orders = value; }
}



My DataAbstraction layer (uses NHibernate) , use 2 sessions: one for read and one for write per client, where in write session we evict the persistence object after save!

I'm using [UseNetDataContractSerializer] attribute as suggested by best practice for NHib. and WCF

I've installed only NHibernate (without castle project), there is no constant scenario for receiving this exception.
I seems like something goes wrong in desterilizing objects in WCF ???

Thank you for reading, every comment will be welcome.

Ofer.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.