-->
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.  [ 6 posts ] 
Author Message
 Post subject: Assembly name was not found! plz help me !
PostPosted: Wed Jul 06, 2005 5:31 pm 
Newbie

Joined: Wed Jul 06, 2005 11:39 am
Posts: 3
I just started nHibernate , I tried quick start but I Receive this error when I try to run it :

“File or assembly name NHibernate.Examples, or one of its dependencies, was not found.”


All I did was this:
Making User class.
Making database .
Making User.hbm.xml as a map and define its Build action as Embedded Resources .
Add nhibernate.dll as a reference
And adding
using NHibernate;
using NHibernate.Cfg;
to top and Entering this code in my Page Lode :


Code:
Configuration cfg = new Configuration();
cfg.AddAssembly("NHibernate.Examples");

ISessionFactory factory = cfg.BuildSessionFactory();
ISession session = factory.OpenSession();
ITransaction transaction = session.BeginTransaction();


NHibernate.Examples.QuickStart.User newUser = new NHibernate.Examples.QuickStart.User();
newUser.Id = "joe_cool";
newUser.UserName = "Joseph Cool";
newUser.Password = "abc123";
newUser.EmailAddress = "joe@cool.com";
newUser.LastLogon = DateTime.Now;

// Tell NHibernate that this object should be saved
session.Save(newUser);

// commit all of the changes to the DB and close the ISession
transaction.Commit();
session.Close();


I know Its very firstly problem, but I really cant solve it by myself.
so please help me ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 07, 2005 4:32 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Are you sure that "NHibernate.Examples" is the name of your assembly ?

Try this:
Code:
cfg.AddAssembly( typeof(NHibernate.Examples.QuickStart.User).Assembly );

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 07, 2005 5:18 am 
Newbie

Joined: Wed Jul 06, 2005 11:39 am
Posts: 3
Thanks for your answering, but it have same error, the complete error is :

Quote:
Server Error in '/nHibtest' Application.

File or assembly name NHibernate.Examples, or one of its dependencies, was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: File or assembly name NHibernate.Examples, or one of its dependencies, was not found.

Source Error:


Line 23: {
Line 24: Configuration cfg = new Configuration();
Line 25: cfg.AddAssembly( typeof(NHibernate.Examples.QuickStart.User).Assembly );
Line 26:
Line 27: ISessionFactory factory = cfg.BuildSessionFactory();


Source File: g:\inetpub\wwwroot\nhibtest\webform1.aspx.cs Line: 25

Assembly Load Trace: The following information can be helpful to determine why the assembly 'NHibernate.Examples' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = NHibernate.Examples
(Partial)
LOG: Appbase = file:///g:/inetpub/wwwroot/nHibtest
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: NHibernate.Examples
LOG: Attempting download of new URL file:///G:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/nhibtest/4bc49ec2/edc3d983/NHibernate.Examples.DLL.
LOG: Attempting download of new URL file:///G:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/nhibtest/4bc49ec2/edc3d983/NHibernate.Examples/NHibernate.Examples.DLL.
LOG: Attempting download of new URL file:///g:/inetpub/wwwroot/nHibtest/bin/NHibernate.Examples.DLL.
LOG: Attempting download of new URL file:///g:/inetpub/wwwroot/nHibtest/bin/NHibernate.Examples/NHibernate.Examples.DLL.
LOG: Attempting download of new URL file:///G:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/nhibtest/4bc49ec2/edc3d983/NHibernate.Examples.EXE.
LOG: Attempting download of new URL file:///G:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/nhibtest/4bc49ec2/edc3d983/NHibernate.Examples/NHibernate.Examples.EXE.
LOG: Attempting download of new URL file:///g:/inetpub/wwwroot/nHibtest/bin/NHibernate.Examples.EXE.
LOG: Attempting download of new URL file:///g:/inetpub/wwwroot/nHibtest/bin/NHibernate.Examples/NHibernate.Examples.EXE.



Stack Trace:


[FileNotFoundException: File or assembly name NHibernate.Examples, or one of its dependencies, was not found.]
System.Type.GetType(String typeName, Boolean throwOnError) +0
NHibernate.Util.ReflectHelper.ClassForName(String name)
NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)

[MappingException: persistent class NHibernate.Examples.QuickStart.User, NHibernate.Examples not found]
NHibernate.Cfg.Binder.BindClass(XmlNode node, PersistentClass model, Mappings mapping)
NHibernate.Cfg.Binder.BindRootClass(XmlNode node, RootClass model, Mappings mappings)
NHibernate.Cfg.Binder.BindRoot(XmlDocument doc, Mappings model)
NHibernate.Cfg.Configuration.Add(XmlDocument doc)
NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader)
NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream)
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
nHibtest.WebForm1.Page_Load(Object sender, EventArgs e) in g:\inetpub\wwwroot\nhibtest\webform1.aspx.cs:25
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()



--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 07, 2005 5:58 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Make sure that "NHibernate.Examples" is in your /bin/ directory
(like g:/inetpub/wwwroot/nHibtest/bin/NHibernate.Examples.dll)

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 08, 2005 5:39 pm 
Newbie

Joined: Wed Jul 06, 2005 11:39 am
Posts: 3
there is no NHibernate.Examples.dll
NHibernate.Examples is actually in User.hbm.xml, so I assume it must be in my own progtam dll
I do only Quick start
http://wiki.nhibernate.org/display/NH/Quick+Start+Guide

did I miss a dll ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 10, 2005 11:08 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
If the name of the assembly containing your entities is not NHibernate.Examples then, you must update:

<class name="NHibernate.Examples.QuickStart.User, TheNameOfYourAssembly" table="users">

in your mapping files (*.hbm.xml)

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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