Hello,
I have just updated from NHibernate 1.2 Beta 1 to Beta 2 in an ASP.NET application and now I receive this error:
Quote:
"<session-factory> element was not found in the configuration file."
It occures when I try to configure NHibernate:
Quote:
"[MappingException: <session-factory> element was not found in the configuration file.]
NHibernate.Cfg.Configuration.DoConfigure(XmlDocument doc) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:1314
NHibernate.Cfg.Configuration.Configure(XmlTextReader reader) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:1301
NHibernate.Cfg.Configuration.Configure(String resource) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:1214
AMS.Data.NHibernateHttpModule.get_CurrentConfiguration() in C:\Dokumente und Einstellungen\dominik\Desktop\AMS\AMS.Data\NHibernateHttpModule.cs:126"
I haven't changed anything in my configuration file. It looks like this:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0" >
<session-factory name="AMS">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
.......
</session-factory>
</hibernate-configuration>
These are the lines of code where the error occures:
Code:
Configuration config = (Configuration)HttpContext.Current.Application[KEY_NHIBERNATE_CONFIGURATION];
if (config == null)
{
config = new Configuration();
if (config == null)
{
throw new InvalidOperationException("NHibernate configuration is null.");
}
config.Configure(HttpContext.Current.Server.MapPath("~/Config/hibernate.cfg.xml"));
HttpContext.Current.Application[KEY_NHIBERNATE_CONFIGURATION] = config;
}
return config;
Have you changed anything from Beta1 to Beta2 concerning the configuration? I couldn't find anything in the jira...
I hope anybody will help me.
Regards,
Dominik