-->
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: Newb Q? Or issue?
PostPosted: Mon Jan 15, 2007 3:04 am 
Newbie

Joined: Mon Jan 15, 2007 2:33 am
Posts: 1
[b]Hibernate version:[/b] NHibernate 1.2.0 beta 3

[b]Mapping documents:[/b] <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Fexen_Server.Account, Fexen_Server" table="Account">
<id name="Name" column="Name" type="String" length="50">
<generator class="assigned" />
</id>
<property name="Password" column= "Password" type="String" length="50"/>
</class>
</hibernate-mapping>

[b]Code between sessionFactory.openSession() and session.close():[/b] N/A (Literally - see lower down)

[b]Full stack trace of any exception that occurs:[/b]
Client 127.0.0.1:2783 Connected

Crash at Test NHibernate.MappingException: Fexen_Server.Sockets.Account.hbm.xml(2,2): XML validation error: Could not find schema information for the element 'u
rn:nhibernate-mapping-2.0:hibernate-mapping'. ---> System.Xml.Schema.XmlSchemaException: Could not find schema information for the element 'urn:nhibernate-mappi
ng-2.0:hibernate-mapping'.
--- End of inner exception stack trace ---
at NHibernate.Cfg.Configuration.LogAndThrow(MappingException me) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 249
at NHibernate.Cfg.Configuration.ValidationHandler(Object o, ValidationEventArgs args) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:lin
e 1588
at System.Xml.Schema.XsdValidator.ProcessElement(Object particle)
at System.Xml.Schema.XsdValidator.Validate()
at System.Xml.XmlValidatingReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at NHibernate.Cfg.Configuration.LoadMappingDocument(XmlTextReader hbmReader, String name) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs
:line 1544
at NHibernate.Cfg.Configuration.AddXmlReader(XmlTextReader hbmReader, String name) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1
574
at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 4
80
at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 517
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly, Boolean skipOrdering) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line
634
at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 596
at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName) in c:\net\nhibernate\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 577
at Fexen_Server.Handler.Test() in C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\Fexen_Server\Sockets\Handler.cs:
line 28


Text from Exception e e.ToString() follows -

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Fexen_Server.Handler.loadacc(String name) in C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\Fexen_Server\Socke
ts\Handler.cs:line 38
at Fexen_Server.Handler.parse(String toParse) in C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\Fexen_Server\Sock
ets\Handler.cs:line 77
at Fexen_Server.Sockets.DataReceived(IAsyncResult asyn) in C:\Documents and Settings\Administrator\Local Settings\Application Data\Temporary Projects\Fexen_S
erver\Sockets\Sockets.cs:line 112
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Press any key to continue . . .

[b]Name and version of the database you are using:[/b] SQL Server Express 2005 SP1

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

[b]Debug level Hibernate log excerpt:[/b] N/A



I've been trying for the past several days to get NHibernate working in, well, any form.

I've copied the NHibernate quickstart guide near-verbatim, and I've copied http://www.fincher.org/tips/Languages/NHibernate.shtml verbatim, minus an initialization class.

Everything that I attempt ends up with the prior stack trace - even if it's of a pre-made project that was "working". Exact same error, near-identical stack trace.

Obviously, I'm a flat out newb to this. However, the following code -always- produces this problem, and I have been unable to find any information (Whether it be RTFMing, googling, or searching on these forums) to help out my problem.

Configuration cfg;
ISessionFactory factory;

cfg = new Configuration();
cfg.AddAssembly("Relevant_Text");
factory = cfg.BuildSessionFactory(); <-- Crashing line


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 3:58 am 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
Please try
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
instead of
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">


Top
 Profile  
 
 Post subject: Re: Newb Q? Or issue?
PostPosted: Mon Jan 15, 2007 4:00 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
Blaen wrote:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Fexen_Server.Account, Fexen_Server" table="Account">
<id name="Name" column="Name" type="String" length="50">
<generator class="assigned" />
</id>
<property name="Password" column= "Password" type="String" length="50"/>
</class>
</hibernate-mapping>


In mappings, replace
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">

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


Gert

_________________
If a reply helps You, rate it!


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.