-->
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: Exception raised in the AddAssembly Method
PostPosted: Wed Jul 11, 2007 5:48 pm 
Newbie

Joined: Wed Jul 11, 2007 11:23 am
Posts: 7
I am doing my first NHibernate application and am having trouble understanding all the relationships between the configuration files and the assemblies and namespaces. Can someone explain why I am getting this exception?


Hibernate version:
1.2.0.GA

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="NHibernate.Examples.QuickStart.UserClass, NHibernateQuickStart" table="users">
<id name="Id" column="LogonId" type="String" length="20">
<generator class="assigned" />
</id>
<property name="UserName" column="Name" type="String" length="40"/>
<property name="Password" type="String" length="20"/>
<property name="EmailAddress" type="String" length="40"/>
<property name="LastLogon" type="DateTime"/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
N/A

Full stack trace of any exception that occurs:
NHibernate.MappingException was unhandled
Message="NHibernateQuickStart.User.hbm.xml(2,2): XML validation error: Could not find schema information for the element 'urn:nhibernate-mapping-2.0:hibernate-mapping'."
Source="NHibernate"
StackTrace:
at NHibernate.Cfg.Configuration.LogAndThrow(MappingException me)
at NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args)
at System.Xml.Schema.BaseValidator.SendValidationEvent(XmlSchemaException e, XmlSeverityType severity)
at System.Xml.Schema.BaseValidator.SendValidationEvent(String code, String msg, XmlSeverityType severity)
at System.Xml.Schema.XsdValidator.ProcessElement(Object particle)
at System.Xml.Schema.XsdValidator.ValidateElement()
at System.Xml.Schema.XsdValidator.Validate()
at System.Xml.XmlValidatingReaderImpl.ProcessCoreReaderEvent()
at System.Xml.XmlValidatingReaderImpl.Read()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at NHibernate.Cfg.Configuration.LoadMappingDocument(XmlTextReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
at NHibernate.Cfg.Configuration.AddResources(Assembly assembly, IList resources, Boolean skipOrdering)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
at NHibernateQuickStart.Program.Main(String[] args) in C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\User\NHibernateQuickStart\Program.cs:line 15
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Name and version of the database you are using:
SQL Server 2000 SP4

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 6:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
I think line 2 needs to be this:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 6:25 pm 
Newbie

Joined: Wed Jul 11, 2007 11:23 am
Posts: 7
karlchu wrote:
I think line 2 needs to be this:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">


It made a difference, I think.
When I do that, I get this exeption

NHibernate.MappingException was unhandled
Message="Could not compile the mapping document: NHibernateQuickStart.User.hbm.xml"
Source="NHibernate"
StackTrace:
at NHibernate.Cfg.Configuration.LogAndThrow(MappingException me)
at NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name)
at NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name)
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
at NHibernate.Cfg.Configuration.AddResources(Assembly assembly, IList resources, Boolean skipOrdering)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering)
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
at NHibernateQuickStart.Program.Main(String[] args) in C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\Projects\User\NHibernateQuickStart\Program.cs:line 15
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 6:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
Judging from your exception message without source code or anything, my guesses are:
1) UserClass does not exist, the class name is is actually "User"
2) NHibernateQuickStart.dll does not actually exist; may be it is NHibernate.Examples.QuickStart

Therefore, the line below:
Code:
<class name="NHibernate.Examples.QuickStart.UserClass, NHibernateQuickStart" table="users">


could actually be something like this:
Code:
<class name="NHibernate.Examples.QuickStart.User, NHibernate.Examples.QuickStart" table="users">


Without any other information, this is my best guess.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 6:56 pm 
Newbie

Joined: Wed Jul 11, 2007 11:23 am
Posts: 7
karlchu wrote:
Judging from your exception message without source code or anything, my guesses are:
1) UserClass does not exist, the class name is is actually "User"
2) NHibernateQuickStart.dll does not actually exist; may be it is NHibernate.Examples.QuickStart

Therefore, the line below:
Code:
<class name="NHibernate.Examples.QuickStart.UserClass, NHibernateQuickStart" table="users">


could actually be something like this:
Code:
<class name="NHibernate.Examples.QuickStart.User, NHibernate.Examples.QuickStart" table="users">


Without any other information, this is my best guess.


Karl,

Thanks for your help. There is a NHibernateQuickStart.dll there is a UserClass.cs file. The namespace inside that UserClass.cs file is NHibernate.Examples.Quickstart and the public class is UserClass.

I am still trying different combinations until it works.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 7:01 pm 
Newbie

Joined: Wed Jul 11, 2007 11:23 am
Posts: 7
Karl,

I got past that error... now I am on to my next one!!!

Let me see if I can figure this one out on my own.

Thanks!!!


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.