gregoun
01-05-2006, 09:19 AM
Hi,
I tried to implement a web application with spring. I create a 3 parts application with View - Services - Persistance.
I specifie my service Object with spring for my .aspx pages.
I seems to be ok because when i test my application, i'm available to navigate into my web site.
My problem is than at a moment spring throw an exception
Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/testsite'.
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: Spring.Context.ApplicationContextException: Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/testsite'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ApplicationContextException: Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/testsite'.]
Spring.Web.Support.AbstractHandlerFactory.GetAppli cationContext(HttpContext context) +120
Spring.Web.Support.PageHandlerFactory.GetHandler(H ttpContext context, String requestType, String url, String path) +152
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +401
System.Web.MapHandlerExecutionStep.System.Web.Http Application.IExecutionStep.Execute() +183
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +191
- I'm using framework aps.net 2.0.
- I've 5 aspx pages using masterpage
- My Web.Config
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<appSettings>
<add key="Log4NetConfigFile" value="~/Config/Log4NET.xml" />
</appSettings>
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Config/Services.xml" />
</context>
</spring>
<system.web>
<httpHandlers>
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
</httpHandlers>
<compilation debug="true"/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
</system.web>
<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<add key="hibernate.connection.connection_string" value="Data Source=LF0512-1\DEV;Initial Catalog=DBTest;Persist Security Info=True;User ID=DBTestUser;Password=boulet"/>
</nhibernate>
</configuration>
- My spring config file :
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<object id="UserManager" type="TestSite.Service.Impl.UserManager, TestSite.Service" singleton="true" scope="application" />
<object id="FunctionManager" type="TestSite.Service.Impl.FunctionManager, TestSite.Service" singleton="true" scope="application" />
<object id="ConnexionManager" type="TestSite.Service.Impl.ConnexionManager, TestSite.Service" singleton="true" scope="application" />
<object id="EditCompte" type="~/EditCompte.aspx">
</object>
<object id="AddFunction" type="~/AddFunction.aspx">
<property name="FunctionManager" ref="FunctionManager"/>
</object>
<object id="Compte" type="~/Compte.aspx">
<property name="UserManager" ref="UserManager"/>
</object>
<object id="ListeCompte" type="~/ListeCompte.aspx">
<property name="UserManager" ref="UserManager"/>
</object>
<object id="Default" type="~/Default.aspx">
<property name="ConnexionManager" ref="ConnexionManager"/>
</object>
</objects>
I don't find any advice for my problem. If somebody can help me.
I tried to implement a web application with spring. I create a 3 parts application with View - Services - Persistance.
I specifie my service Object with spring for my .aspx pages.
I seems to be ok because when i test my application, i'm available to navigate into my web site.
My problem is than at a moment spring throw an exception
Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/testsite'.
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: Spring.Context.ApplicationContextException: Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/testsite'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ApplicationContextException: Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/testsite'.]
Spring.Web.Support.AbstractHandlerFactory.GetAppli cationContext(HttpContext context) +120
Spring.Web.Support.PageHandlerFactory.GetHandler(H ttpContext context, String requestType, String url, String path) +152
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +401
System.Web.MapHandlerExecutionStep.System.Web.Http Application.IExecutionStep.Execute() +183
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +191
- I'm using framework aps.net 2.0.
- I've 5 aspx pages using masterpage
- My Web.Config
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</configSections>
<appSettings>
<add key="Log4NetConfigFile" value="~/Config/Log4NET.xml" />
</appSettings>
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Config/Services.xml" />
</context>
</spring>
<system.web>
<httpHandlers>
<add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
</httpHandlers>
<compilation debug="true"/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20" />
</system.web>
<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect"/>
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
<add key="hibernate.connection.connection_string" value="Data Source=LF0512-1\DEV;Initial Catalog=DBTest;Persist Security Info=True;User ID=DBTestUser;Password=boulet"/>
</nhibernate>
</configuration>
- My spring config file :
<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net">
<object id="UserManager" type="TestSite.Service.Impl.UserManager, TestSite.Service" singleton="true" scope="application" />
<object id="FunctionManager" type="TestSite.Service.Impl.FunctionManager, TestSite.Service" singleton="true" scope="application" />
<object id="ConnexionManager" type="TestSite.Service.Impl.ConnexionManager, TestSite.Service" singleton="true" scope="application" />
<object id="EditCompte" type="~/EditCompte.aspx">
</object>
<object id="AddFunction" type="~/AddFunction.aspx">
<property name="FunctionManager" ref="FunctionManager"/>
</object>
<object id="Compte" type="~/Compte.aspx">
<property name="UserManager" ref="UserManager"/>
</object>
<object id="ListeCompte" type="~/ListeCompte.aspx">
<property name="UserManager" ref="UserManager"/>
</object>
<object id="Default" type="~/Default.aspx">
<property name="ConnexionManager" ref="ConnexionManager"/>
</object>
</objects>
I don't find any advice for my problem. If somebody can help me.