-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: <session-factory> element was not found in the configu
PostPosted: Sat Nov 11, 2006 3:16 am 
Beginner
Beginner

Joined: Mon Mar 20, 2006 7:59 am
Posts: 30
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 11, 2006 3:40 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
The versions of the XML schemas were changed to 2.2. Use xmlns="urn:nhibernate-configuration-2.2".


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 11, 2006 4:03 am 
Beginner
Beginner

Joined: Mon Mar 20, 2006 7:59 am
Posts: 30
Thank you for this information. Now my application runs flawlessly again :-)

Thanks for the update aswell!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.