-->
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.  [ 4 posts ] 
Author Message
 Post subject: Persistent Class not found Error...
PostPosted: Mon Jan 08, 2007 1:46 pm 
Newbie

Joined: Mon Jan 08, 2007 11:55 am
Posts: 5
Hi there,

I'm trying to set up an nHibernate Example as shown in the quick start guide (Link: http://www.hibernate.org/362.html ). Unfortunately, I can't even load my Assembly using Configuration.addAssembly(). I get an exception "persistent class not found"...

I have set the buildoption for my XML-File on "Embedded Ressource".

Can anybody provide me with some ideas on what the error could be? I'm searching for a solution for some hours now and can't find anything.

Thanks a lot for your time and patience!


nHibernate version:
1.03

Mapping documents:

XML File:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB" table="users">
<id name="ID" column="ID" type="Int32">
<generator class="assigned" />
</id>
<property name="MaterialgroupID" column="MaterialgroupID" type="Int32"/>
<property name="Number" column="Number" type="String" length="255"/>
<property name="Username" column="Username" type="String" length="255"/>
<property name="Timestamp" column="Timestamp" type="DateTime"/>
</class>
</hibernate-mapping>


C#-FILE:

using System;
using System.Collections.Generic;
using System.Text;

namespace IFCC.tools.tryouts.NHT2.DB
{
public class Article
{
private int m_ID;
private int m_MaterialgroupID;
private String m_Number;
private String m_Username;
private DateTime m_Timestamp;

public Article()
{

}

public int ID
{
set { this.m_ID = value; }
get { return this.m_ID; }
}

public int MaterialgroupID
{
set { this.m_MaterialgroupID = value; }
get { return this.m_MaterialgroupID; }
}

public String Number
{
set { this.m_Number = value; }
get { return this.m_Number; }
}

public String Username
{
set { this.m_Username = value; }
get { return this.m_Username; }
}

public DateTime Timestamp
{
set { this.m_Timestamp = value; }
get { return this.m_Timestamp; }
}
}
}


Code between sessionFactory.openSession() and session.close():
- none -

Full stack trace of any exception that occurs:
18:34:01.718 [3272] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)

Name and version of the database you are using:
MSSQL Server 9.00.1399.06

The generated SQL (show_sql=true):
- none -

Debug level Hibernate log excerpt:
18:34:01.562 [3272] INFO NHibernate.Cfg.Environment - NHibernate 1.0.2
18:34:01.578 [3272] INFO NHibernate.Cfg.Environment - Using reflection optimizer
18:34:01.578 [3272] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:34:01.593 [3272] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:34:01.656 [3272] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:34:01.718 [3272] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
18:34:14.093 [3272] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:34:14.093 [3272] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:34:14.093 [3272] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:34:14.140 [3272] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
18:35:13.031 [3272] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:35:13.031 [3272] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:35:13.031 [3272] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:35:13.062 [3272] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
18:35:23.890 [2824] INFO NHibernate.Cfg.Environment - NHibernate 1.0.2
18:35:23.906 [2824] INFO NHibernate.Cfg.Environment - Using reflection optimizer
18:35:23.906 [2824] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:35:23.921 [2824] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:35:23.984 [2824] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:35:24.046 [2824] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
18:35:25.765 [2824] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:35:25.765 [2824] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:35:25.765 [2824] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:35:25.781 [2824] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
18:39:04.656 [2824] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:39:04.656 [2824] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:39:04.656 [2824] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:39:04.671 [2824] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)
18:39:07.265 [2824] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IFCC
18:39:07.265 [2824] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: IFCC.tools.tryouts.NHT2.DB.Article.hbm.xml
18:39:07.265 [2824] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2000Dialect
18:39:07.296 [2824] ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document
NHibernate.MappingException: persistent class IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB not found ---> System.TypeLoadException: Could not load type 'IFCC.tools.tryouts.NHT2.DB.Article, IFCC.tools.tryouts.NHT2.DB', check that type and assembly names are correct
bei NHibernate.Util.ReflectHelper.ClassForName(String name)
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
--- Ende der internen Ausnahmestapelüberwachung ---
bei NHibernate.Cfg.Binder.ClassForFullNameChecked(String fullName, String errorMessage)
bei NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
bei NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
bei NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
bei NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 2:00 am 
Newbie

Joined: Fri Sep 02, 2005 6:03 pm
Posts: 13
I'm having the same issue. Any luck fixing it yet?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 25, 2007 4:03 am 
Newbie

Joined: Mon Jan 08, 2007 11:55 am
Posts: 5
My collegue fixed the issue - so I cannot tell in detail what the problem was. All I know is that it had something to do with namespaces. So solving the problem is about having a close look on the namespaces in the .hbm.xml files.


Top
 Profile  
 
 Post subject: Problem solving
PostPosted: Fri Feb 23, 2007 8:00 am 
Newbie

Joined: Fri Feb 23, 2007 6:56 am
Posts: 1
Location: Sosnowiec, POLAND
I suppouse You have wrong order of configuration steps.

Proper order is shown bellow:

Code:
// Create configuration object
Configuration cfg = new Configuration();
// Add Your mappings here
cfg.AddAssembly("Your.Assembly");
// Build session factory
sessions = cfg.BuildSessionFactory();


If You add Your mappings after You build session factory Your session can't find objects.

_________________
Rafał Ziółkowski
http://csharpblog.lapshanq.dt.pl [EN]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.