tdu
04-07-2006, 11:48 PM
I have 3 tier structure. Web,Interface and Web Service. I am using SprintNEt WebService proxy creation at Web service layer and use SprintNet clientproxy creation on my Interface tier. So, my web tier doesn't have to know any knowledge of proxy creation. All it did is using xmlApplicationContext to getObject defined in my Interface tier with embbed the xml resource.
Everything works fine on the first run, but fails on the postback or refresh. It complaints about the "Duplicate type name within an assembly". I have to recycle aspnet work process to be able to run the application again.
On my web tier (not a springNet web aware, only has assembly reference)
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
XmlApplicationContext ctx = new XmlApplicationContext("assembly://SpringNetContract/SpringNetContract.Config/Contact_Dev.xml");
SpringNetContract.ContactHelper helper=(SpringNetContract.ContactHelper)ctx.GetObj ect("contactHelper");
this.datagrid1.DataSource=helper.GetXOContacts();
this.datagrid1.DataBind();
}
}
The Contact_Dev.xml is on my Interface tier with embeded resource compilation turned on for the xml file
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<!--
<object id="IContactService" type="Spring.Web.Services.WebServiceClientFactory, Spring.Services" >
<property name="ServiceUrl" value="http://localhost/SpringNetService/ContactExporter.asmx" />
<property name="ServiceInterface" value="SpringNetContract.IContact, SpringNetContract" />
</object>
<object id="contactHelper" type="SpringNetContract.ContactHelper,SpringNetContract" singleton="false">
<property name="ContactService" ref="IContactService" />
</object>
</objects>
The Interface tier I have a contactHelper.cs
public ContactHelper()
{
}
#region public property
private SpringNetContract.IContact contactService;
//
public IContact ContactService
{
set { contactService = value; }
get {return contactService;}
}
#endregion
#region public method
public xo.Common.BusinessObject.ContactCollection GetXOContacts()
{
return ContactService.GetXOContacts();
}
Everything hooked up. It worked. However, if I refresh the page, I got some error from AbstractObjectFactory.cs from Spring.Objects.Factory.Support on line 598(I am using the 4/7/06 build)
The error message is:
Duplicate type name within an assembly.
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.ArgumentException: Duplicate type name within an assembly.
Source Error:
Line 54: XmlApplicationContext ctx = new XmlApplicationContext("assembly://SpringNetContract/SpringNetContract.Config/Contact_Dev.xml");
Line 55:
Line 56: SpringNetContract.ContactHelper helper=(SpringNetContract.ContactHelper)ctx.GetObj ect("contactHelper");
Line 57:
Line 58: this.datagrid1.DataSource=helper.GetXOContacts();
Source File: c:\springnetexample\sample\springnetwebclient\webf orm2.aspx.cs Line: 56
Stack Trace:
[ArgumentException: Duplicate type name within an assembly.]
System.Reflection.Emit.AssemblyBuilderData.CheckTy peNameConflict(String strTypeName, TypeBuilder enclosingType) +312
System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType) +176
System.Reflection.Emit.TypeBuilder..ctor(String name, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, TypeBuilder enclosingType) +28
System.Reflection.Emit.ModuleBuilder.DefineType(St ring name, TypeAttributes attr, Type parent) +88
Spring.Proxy.CompositionProxyTypeBuilder.CreateTyp eBuilder() in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Proxy\CompositionProxyTypeBuilder.cs:198
Spring.Web.Services.SoapHttpClientProxyTypeBuilder .BuildProxy() in c:\projects\daily\Spring.Net\src\Spring\Spring.Ser vices\Web\Services\WebServiceClientFactory.cs:505
Spring.Web.Services.WebServiceClientFactory.Genera teProxy() in c:\projects\daily\Spring.Net\src\Spring\Spring.Ser vices\Web\Services\WebServiceClientFactory.cs:334
Spring.Web.Services.WebServiceClientFactory.GetObj ect() in c:\projects\daily\Spring.Net\src\Spring\Spring.Ser vices\Web\Services\WebServiceClientFactory.cs:263
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObjectForSharedInstance(String name, Object instance) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :596
[ObjectCreationException: Error thrown by a dependency of object 'contactHelper' defined in 'assembly [SpringNetContract, Version=1.0.2288.29063, Culture=neutral, PublicKeyToken=null], resource [SpringNetContract.Config.Contact_Dev.xml]' : IFactoryObject threw exception on object creation.
while resolving 'ContactService' to '' ]
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveReference(IConfigurableOb jectDefinition definition, String name, String argumentName, RuntimeObjectReference reference) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:1703
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveValueIfNecessary(String name, RootObjectDefinition definition, String argumentName, Object argumentValue) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:1584
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ApplyPropertyValues(String name, RootObjectDefinition definition, IObjectWrapper wrapper, IPropertyValues properties) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:290
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.PopulateObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:394
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:745
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:609
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Type requiredType, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :242
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :1203
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :1163
Spring.Context.Support.AbstractApplicationContext. GetObject(String name) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Context\Support\AbstractApplicationContext.cs:11 22
springTest.WebForm2.Page_Load(Object sender, EventArgs e) in c:\springnetexample\sample\springnetwebclient\webf orm2.aspx.cs:56
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +739
Any help is appreciate.
Thanks
Tony
Everything works fine on the first run, but fails on the postback or refresh. It complaints about the "Duplicate type name within an assembly". I have to recycle aspnet work process to be able to run the application again.
On my web tier (not a springNet web aware, only has assembly reference)
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
XmlApplicationContext ctx = new XmlApplicationContext("assembly://SpringNetContract/SpringNetContract.Config/Contact_Dev.xml");
SpringNetContract.ContactHelper helper=(SpringNetContract.ContactHelper)ctx.GetObj ect("contactHelper");
this.datagrid1.DataSource=helper.GetXOContacts();
this.datagrid1.DataBind();
}
}
The Contact_Dev.xml is on my Interface tier with embeded resource compilation turned on for the xml file
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<!--
<object id="IContactService" type="Spring.Web.Services.WebServiceClientFactory, Spring.Services" >
<property name="ServiceUrl" value="http://localhost/SpringNetService/ContactExporter.asmx" />
<property name="ServiceInterface" value="SpringNetContract.IContact, SpringNetContract" />
</object>
<object id="contactHelper" type="SpringNetContract.ContactHelper,SpringNetContract" singleton="false">
<property name="ContactService" ref="IContactService" />
</object>
</objects>
The Interface tier I have a contactHelper.cs
public ContactHelper()
{
}
#region public property
private SpringNetContract.IContact contactService;
//
public IContact ContactService
{
set { contactService = value; }
get {return contactService;}
}
#endregion
#region public method
public xo.Common.BusinessObject.ContactCollection GetXOContacts()
{
return ContactService.GetXOContacts();
}
Everything hooked up. It worked. However, if I refresh the page, I got some error from AbstractObjectFactory.cs from Spring.Objects.Factory.Support on line 598(I am using the 4/7/06 build)
The error message is:
Duplicate type name within an assembly.
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.ArgumentException: Duplicate type name within an assembly.
Source Error:
Line 54: XmlApplicationContext ctx = new XmlApplicationContext("assembly://SpringNetContract/SpringNetContract.Config/Contact_Dev.xml");
Line 55:
Line 56: SpringNetContract.ContactHelper helper=(SpringNetContract.ContactHelper)ctx.GetObj ect("contactHelper");
Line 57:
Line 58: this.datagrid1.DataSource=helper.GetXOContacts();
Source File: c:\springnetexample\sample\springnetwebclient\webf orm2.aspx.cs Line: 56
Stack Trace:
[ArgumentException: Duplicate type name within an assembly.]
System.Reflection.Emit.AssemblyBuilderData.CheckTy peNameConflict(String strTypeName, TypeBuilder enclosingType) +312
System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType) +176
System.Reflection.Emit.TypeBuilder..ctor(String name, TypeAttributes attr, Type parent, Type[] interfaces, Module module, PackingSize iPackingSize, TypeBuilder enclosingType) +28
System.Reflection.Emit.ModuleBuilder.DefineType(St ring name, TypeAttributes attr, Type parent) +88
Spring.Proxy.CompositionProxyTypeBuilder.CreateTyp eBuilder() in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Proxy\CompositionProxyTypeBuilder.cs:198
Spring.Web.Services.SoapHttpClientProxyTypeBuilder .BuildProxy() in c:\projects\daily\Spring.Net\src\Spring\Spring.Ser vices\Web\Services\WebServiceClientFactory.cs:505
Spring.Web.Services.WebServiceClientFactory.Genera teProxy() in c:\projects\daily\Spring.Net\src\Spring\Spring.Ser vices\Web\Services\WebServiceClientFactory.cs:334
Spring.Web.Services.WebServiceClientFactory.GetObj ect() in c:\projects\daily\Spring.Net\src\Spring\Spring.Ser vices\Web\Services\WebServiceClientFactory.cs:263
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObjectForSharedInstance(String name, Object instance) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :596
[ObjectCreationException: Error thrown by a dependency of object 'contactHelper' defined in 'assembly [SpringNetContract, Version=1.0.2288.29063, Culture=neutral, PublicKeyToken=null], resource [SpringNetContract.Config.Contact_Dev.xml]' : IFactoryObject threw exception on object creation.
while resolving 'ContactService' to '' ]
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveReference(IConfigurableOb jectDefinition definition, String name, String argumentName, RuntimeObjectReference reference) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:1703
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ResolveValueIfNecessary(String name, RootObjectDefinition definition, String argumentName, Object argumentValue) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:1584
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.ApplyPropertyValues(String name, RootObjectDefinition definition, IObjectWrapper wrapper, IPropertyValues properties) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:290
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.PopulateObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:394
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:745
Spring.Objects.Factory.Support.AbstractAutowireCap ableObjectFactory.CreateObject(String name, RootObjectDefinition definition, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractAutowireCapableO bjectFactory.cs:609
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Type requiredType, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :242
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name, Object[] arguments) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :1203
Spring.Objects.Factory.Support.AbstractObjectFacto ry.GetObject(String name) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Objects\Factory\Support\AbstractObjectFactory.cs :1163
Spring.Context.Support.AbstractApplicationContext. GetObject(String name) in c:\projects\daily\Spring.Net\src\Spring\Spring.Cor e\Context\Support\AbstractApplicationContext.cs:11 22
springTest.WebForm2.Page_Load(Object sender, EventArgs e) in c:\springnetexample\sample\springnetwebclient\webf orm2.aspx.cs:56
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +739
Any help is appreciate.
Thanks
Tony