PDA

View Full Version : Maybe a Bug!!! GetApplicationContext error!


garypayton
11-29-2005, 04:00 PM
Hi
I do an example and get this exception: Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/yosemite'. (of course "yosemite" is my peroject name)

My example is using a frameset page which include two aspx page (Left.aspx and Content.aspx), I registered these pages in configuration file like
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="config://spring/objects" />
</context>
<objects xmlns="http://www.springframework.net">
<object type="~/Management/Left.aspx" />
<object type="~/Management/Content.aspx" />
</objects>
</spring>

when I open the frameset page,one of the two frame pages always throw that exception. Even worse sometimes is Left.aspx,sometimes is Content.aspx and it only happed when the appdomain is firstly initialized.After more investigation, I thought it maybe caused by synchronously accessing shared resource. I traced the spring.web source code Web/Support/PageHandlerFactory.cs PageHandlerFactory.GetHandler method, it had this code snippetIApplicationContext appContext = GetApplicationContext(context);
I found when each one initialized here, first one is ok,senconde one is failed and thrown Existing context 'Spring.Context.Support.WebApplicationContext' already registered under name '/yosemite'.

What's your idea?

After I edit upper code to
IApplicationContext appContext;

lock(typeof(PageHandlerFactory))
{
appContext = GetApplicationContext(context);
}

exception disappeared...........
I don't know why context.GetConfig failed in this case, but my experiences tell me most of dotnet method is not thread safe.


Hehe, if it is really a problem and you need more staff, please contact me. I expect your answer.

Rick Evans
11-30-2005, 08:54 AM
Hi

Yes, there was no synchronization in the area you describe, and indeed, it was a bug.

I say was because the issue has now been sorted by Aleks (Seovic). The fix is present in the code in the CVS HEAD, and will (of course) be present in the next release.

Cheers
Rick

Aleks Seovic
11-30-2005, 12:52 PM
Yeah, it looks like you are using an older version of the code...

If you get the latest code from CVS this issue should be fixed.

Regards,

Aleks

garypayton
12-06-2005, 05:17 AM
Could you please tell me how to find the bug list

Bruno Baia
12-06-2005, 09:14 AM
There is a link to "JIRA Issue Tracking" in the Spring .NET homepage :
http://www.springframework.net/

garypayton
12-12-2005, 02:22 AM
Thx very much for your reply