View Full Version : Difficult to debug xml validation errors or ?
Anonymous
12-20-2004, 10:35 PM
In Spring.Objects.Factory.Xml.LoadObjectDefinitions the finally statement prevent the exceptions to be thrown back to the client.
So in my web app. the only thing I get is "Exception in configuration section handler.", when the xml validation fails. Have I missed something, are there any way to get the validation error ?
best regards
Henrik Uffe Jensen
Mark Pollack
12-21-2004, 12:35 AM
Hi Henrik,
The validation event handler delegate (HandleValidation) throws an XmlException, which would get rethrown to the client wrapped inside a ObjectDefinitonStoreException.
I tried to reproduce the erro but couldn't, can you cut-n-paste the specific case so I can investigate, or email me the files directly. I don't see the string "Exception in configuration section handler." in the code base so I'm not quite sure what is going on.
If you are using App.config or web equivalent to store the spring configuration the 0.6.0 RC1 release did not perform validation at all, this has now been fixed in CVS.
Cheers,
Mark
Anonymous
12-22-2004, 08:28 PM
I found out that what is returned to my web app is a System.Configuration.ConfigurationException, and that the XMLException or any other exceptions from Spring is present as an innerException.
But for some reason if I just let that exception bubble I see only the ConfigurationException message "Exception in configuration section handler" and no additional information, stack trace etc. regarding the innerException. Little difficult to debug the Spring XML with no hint about the error at all. :-)
However now I just do the following. Catch the exception and wrap the innerException. That way I get the exception from Spring bubbled correct and I can see the reason for the exception
try
{
IApplicationContext appContext = ConfigurationSettings.GetConfig("objects") as IApplicationContext;
}
catch (ConfigurationException ex)
{
throw new ApplicationException("Error getting Spring ApplicationContext : ConfigurationException occured", ex.InnerException);
}
catch (Exception ex)
{
throw new ApplicationException("Error getting Spring ApplicationContext", ex);
}
So this has to be some .NET Framework misconfiguration problem etc, which makes ConfigurationException behave strangely and not the Spring Framework. Sorry
Henrik Uffe Jensen
Aleks Seovic
12-27-2004, 09:57 AM
I've seen this behavior when loading web application context, and yes, it is .Net issue for the most part.
That said, I will change the code that instantiates web application context along the lines of your workaround so we get more useful error messages.
Thanks for the hint,
Aleks
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.