-->
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: Problem with nhConfig.AddAssembly("Hibernate");
PostPosted: Sun May 13, 2007 5:03 pm 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
Hey,

I have a problem in my Global.cs file
(its a file i have copied from a working example)

namespace Hibernate
{
public sealed class Global
{
private static Configuration nhConfig;
private static ISessionFactory nhFactory;

[STAThread]
static void Main()
{
nhConfig = new Configuration();
nhConfig.AddAssembly("Hibernate"); <---My exception is here
nhFactory = nhConfig.BuildSessionFactory();
}

public static ISession NHSession
{
get { return nhFactory.OpenSession(); }
}

private Global() { }
}
}


If you need some more info then let me know.
Im kind of new to .net and to NHibernate so im having some trouble to see through this exception.
Any help would be preciated :)

Hibernate version: 1.2.0.GA

My App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<log4net>
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender, log4net" >
<param name="File" value="log.txt" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy.MM.dd" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout, log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] &lt;%X{auth}&gt; - %m%n" />
</layout>
</appender>
<root>
<priority value="DEBUG" />
<appender-ref ref="rollingFile" />
</root>
</log4net>

<nhibernate>
<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.dialect" value="NHibernate.Dialect.MsSql2000Dialect" />
<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />
<add key="hibernate.connection.connection_string" value="Server=localhost;Database=nhibernate;User=sa;Pwd=bp6703;" />
<add key="hibernate.show_sql" value="true" />
</nhibernate>
</configuration>

My Login.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="Hibernate" namespace="Hibernate">
<class name="Login" table="login">

<id name="Recordid" column="recordid" type="Int64" unsaved-value="0">
<generator class="assigned"/>
</id>
<property column="user" type="String" name="User" length="0" />
<property column="password" type="String" name="Password" length="0" />

</class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
System.IO.FileNotFoundException was unhandled
Message="Could not load file or assembly 'Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. Den angivne fil blev ikke fundet."
Source="NHibernate"
FileName="Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4"
FusionLog="=== Pre-bind state information ===\r\nLOG: User = MAXIMUSS_PC\\maximuss\r\nLOG: DisplayName = Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4\n (Fully-specified)\r\nLOG: Appbase = file:///F:/Visual Studio 2005/Projects/NHibernate/Hibernate/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : NHibernate, Version=1.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: Using application configuration file: F:\\Visual Studio 2005\\Projects\\NHibernate\\Hibernate\\bin\\Debug\\Hibernate.vshost.exe.config\r\nLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4\r\nLOG: Attempting download of new URL file:///F:/Visual Studio 2005/Projects/NHibernate/Hibernate/bin/Debug/Iesi.Collections.DLL.\r\nLOG: Attempting download of new URL file:///F:/Visual Studio 2005/Projects/NHibernate/Hibernate/bin/Debug/Iesi.Collections/Iesi.Collections.DLL.\r\nLOG: Attempting download of new URL file:///F:/Visual Studio 2005/Projects/NHibernate/Hibernate/bin/Debug/Iesi.Collections.EXE.\r\nLOG: Attempting download of new URL file:///F:/Visual Studio 2005/Projects/NHibernate/Hibernate/bin/Debug/Iesi.Collections/Iesi.Collections.EXE.\r\n"
StackTrace:
at NHibernate.Cfg.AssemblyHbmOrderer.GetHbmFiles()
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 Hibernate.Global.Main() in F:\Visual Studio 2005\Projects\NHibernate\Hibernate\Global.cs:line 18
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/VS im using:
Visual Studio 2005 and MsSql 2005


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 13, 2007 7:27 pm 
Regular
Regular

Joined: Sun Jan 21, 2007 4:33 pm
Posts: 65
The key to your error message is here:
Quote:
System.IO.FileNotFoundException was unhandled
Message="Could not load file or assembly 'Iesi.Collections, Version=1.0.0.3,


You need to add Iesi.Collections.dll to your references in Visual Studio 2005 (Right hand pane, solution explorer). Also make sure to type "using Iesi.Collections;" (without quotes) at the top of the files that reference Iesi.Collections.dll.

Please make sure to give credits if this post helped solve the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 4:57 am 
Newbie

Joined: Fri Jun 24, 2005 6:04 am
Posts: 14
I can see the DLL file below References and i have this in the class where the exception is:

using Iesi.Collections;

But it do not help me at all :(

I have tryed to follow the Quick Start from NHibernate, but its exactly the same problem


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 7:13 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Sounds like an assembly versioning problem to me. Make sure you have the correct version of the Iesi assembly that matches the NHibernate assembly.

Cheers,

Symon.


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.