NHibernate 3.0 configuration with ODP.NET - nhibernate

I just setup NHibernate for the first time. My platform and config settings as follows:
Database: Oracle 11.1g
ODP.NET Version: 4.112.1.2 (Installed from ODTWithODAC112012, which is a 1 release above my Oracle db installation)
NHibernate Version 3.0
I created a test MVC app with a test project. Then, to test for NHibernate connection, I use the following test fixture:
using IBCService.Models;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using NUnit.Framework;
namespace IBCService.Tests
{
[TestFixture]
public class GenerateSchema_Fixture
{
[Test]
public void Can_generate_schema()
{
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof(Product).Assembly);
new SchemaExport(cfg).Execute(false, true, false);
}
}
The Nhibernate config file:
<?xml version="1.0" encoding="utf-8"?>
<!-- This config use Oracle Data Provider (ODP.NET) -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
<property name="connection.connection_string">
User ID=TEST;Password=******;Data Source=//RAND
</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
On test, I get the following exception stack trace:
NHibernate.HibernateException was unhandled by user code
Message=Could not create the driver from NHibernate.Driver.OracleDataClientDriver.
Source=NHibernate
StackTrace:
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProvider.cs:line 113
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProvider.cs:line 64
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProviderFactory.cs:line 50
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1 scriptAction, Boolean export, Boolean justDrop) in d:\CSharp\NH\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaExport.cs:line 333
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script, Boolean export, Boolean justDrop) in d:\CSharp\NH\nhibernate\src\NHibernate\Tool\hbm2ddl\SchemaExport.cs:line 290
at IBCService.Tests.GenerateSchema_Fixture.Can_generate_schema() in D:\APPS\VS2010\IBanking\CustomerService\IBCService.Tests\GenerateSchema_Fixture.cs:line 21
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type) in d:\CSharp\NH\nhibernate\src\NHibernate\Bytecode\ActivatorObjectsFactory.cs:line 9
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProvider.cs:line 107
InnerException: System.NullReferenceException
Message=Object reference not set to an instance of an object.
Source=NHibernate
StackTrace:
at NHibernate.Driver.OracleDataClientDriver..ctor() in d:\CSharp\NH\nhibernate\src\NHibernate\Driver\OracleDataClientDriver.cs:line 42
InnerException:
If I change NHibernate.Driver.OracleDataClientDriver to NHibernate.Driver.OracleClientDriver (MS provider for Oracle), the test succeed. Can someone tell me what I'm doing wrong?

Hi
I think the error happens, because Nhibernate is not loading the driver from the GAC with Assembly.LoadWithPartialName(), but with Assembly.Load(). Try to place Oracle.DataAccess.dll in the bin directory or use qualifyAssembly section into your app.config or web.config.
Example:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</assemblyBinding>
</runtime>

#PerlDev: I think that you have a "ODP.NET 32 bit binary" installed and you are compiling your app with platform "AnyCPU". If so, try to change to x86 (this is what I did, and worked).
If you want to compile as x64 I think you must install the "ODP.NET 64 bit binary" (I didnĀ“t do it yet).

This worked for me.
Go Build / Configuration Manager in Visual Studio. Check the platform column. I changed debug from Any CPU to x64

Related

Ninject "No parameterless constructor defined for this object."

I'm testing Ninject, but following the how-to, i find it impossible to make it work. The information on the web is so messy even contradictory. I'm developping a website in MVC 4 on visual studio 2012 and i did install Ninject using Nuget.
So I get an error : "No parameterless constructor defined for this object.". As soon as I enter my controller.
I did the necessary steps :
Nuget installation
in NinjectWebCommon.cs, I did register my Interface in the RegisterServices method.
In my homecontroller I set my object like this :
public ISurvey _survey { get; set; }
[Inject]
public HomeController(ISurvey s)
{
_survey = s;
}
And I get the following error message :
Server Error in '/' Application.
No parameterless constructor defined for this object.
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.MissingMethodException: No parameterless constructor defined for this object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
System.Activator.CreateInstance(Type type) +6
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +110
[InvalidOperationException: An error occurred when trying to create a controller of type 'Surveys.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +247
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +438
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +226
System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +326
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +177
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +88
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +50
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +301
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
So I wonder what did I do wrong ? 4 Hours on it, I found that there may be a problem with my web.config file or that It could be a reference missing, or it could be a factory missing. Right now I don't even know what to do. Thanks for your help.
You must also install Ninject.MVC3 (https://www.nuget.org/packages/Ninject.MVC3/) which includes the Ninject Controller Factory, that takes care of instantiating the controllers and injecting the right dependencies into the controller constructor. I am almost certain that if you install Ninject.MVC3 through Nuget, everything gets configured automaticaly.
Without this package, MVC uses its default controller factory, that knows nothing about injecting dependencies.
Check if in your Web.config you have two lines for MVC versioning, I had something like:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="4.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
If you do then replace them with one line like, to redirect to highest version that you are using in my case it's 4.0.0.1:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
This did it for me.

NServiceBus + Common.Logging + NLog

I'm trying to figure out how to use NServiceBus in combination withCommon.Logging. I just can not get it running. I try to develop a small demo application just for educational purpose.
What I did was:
1) Create a simple console application and imported Common.Logging and Common,Logging.NLog, added some Info messages and added an App.Config file:
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
<arg key="level" value="DEBUG" />
<arg key="showLogName" value="true" />
<arg key="showDataTime" value="true" />
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
</factoryAdapter>
</logging>
</common>
</configuration>
That worked just fine. But when I include NServiceBus:
var bus = Configure.With().DefaultBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional( true )
.UnicastBus()
.MsmqSubscriptionStorage()
.CreateBus()
.Start( () => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install() );
I get this exception:
System.TypeInitializationException was unhandled
Message=The type initializer for 'NServiceBus.Configure' threw an exception.
Source=NServiceBus.Core
TypeName=NServiceBus.Configure
StackTrace:
at NServiceBus.Configure.With()
at ConsoleApplication1.Program.Main(String[] args) in D:\Development\katas\ConsoleApplication1\ConsoleApplication1\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Common.Logging.ConfigurationException
Message=ConfigurationReader Common.Logging.Configuration.DefaultConfigurationReader returned unknown settings instance of type Common.Logging.Configuration.LogSetting
Source=NServiceBus.Core
StackTrace:
at Common.Logging.Configuration.ArgUtils.Guard[T](Function`1 function, String messageFormat, Object[] args)
at Common.Logging.Configuration.ArgUtils.Guard(Action action, String messageFormat, Object[] args)
at Common.Logging.LogManager.BuildLoggerFactoryAdapter()
at Common.Logging.LogManager.get_Adapter()
at Common.Logging.LogManager.GetLogger(String name)
at NServiceBus.Configure..cctor()
InnerException: System.ArgumentOutOfRangeException
Message=Type 'Common.Logging.Configuration.LogSetting, Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e' of parameter 'sectionResult' is not assignable to target type 'Common.Logging.Configuration.LogSetting, NServiceBus.Core, Version=3.2.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c'
Parameter name: sectionResult
Actual value was Common.Logging.Configuration.LogSetting.
Source=NServiceBus.Core
ParamName=sectionResult
StackTrace:
at Common.Logging.Configuration.ArgUtils.AssertIsAssignable[T](String paramName, Type valType, String messageFormat, Object[] args)
at Common.Logging.Configuration.ArgUtils.AssertIsAssignable[T](String paramName, Type valType)
at Common.Logging.LogManager.<>c__DisplayClass3.<BuildLoggerFactoryAdapter>b__1()
at Common.Logging.Configuration.ArgUtils.<>c__DisplayClass13.<Guard>b__12()
at Common.Logging.Configuration.ArgUtils.Guard[T](Function`1 function, String messageFormat, Object[] args)
InnerException:
I've already tried several things suggested in StackOverflow and other groups, but I just can't get it working. Can anyone offer some advice on how to approach this? Or provide a simple example?
This setup shouldn't be to fancy, right? I don't even need logging for the NServiceBus part for now.
Thanks!
NServiceBus has it's own version of Common.Logging that is ilmerged and internalized into the Core dll, that it uses to configure it's own logging (using log4net). When it starts up it discovers the configuration section in your app.config and tries to load it. However, your configuration section (called "logging") points to the external Common.Logging dll:
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
Where NSB wants it to look like:
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, NServiceBus.Core" />
Because of this, NSB throws an error. This is most certainly a bug in NSB. I suggest you create an issue on their github project.
While maybe not the most optimal solution in your case, the quickest way to work around it is to delete the logging section in app.config and configure Common.Logging in code. Or, skip using Common.Logging altogether and use NLog directly.
I might add that this problem will go away in NSB 4.0 where Common.Logging is not used anymore.

Could not create the driver from NHibernate.Driver.SQLiteDriver

I am sorry I am posting this question again. I googled for it and found many posts and threads on stackoverflow and other ones, but none wokred for me.
I get this error message when I run my Windows Forms Application.
Here is my App.config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory name="NHibernate.Test">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLiteDriver</property>
<property name="connection.connection_string">
Data Source=nhibernate.db;Version=3;New=True;
</property>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="query.substitutions">true=1;false=0</property>
<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu
</property>
</session-factory>
</hibernate-configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
I am using Visual Studio 2010, on Windows Server 2008 R2 64 Bit.
My project configuration is X86, and I tried the x86, x64 and ManagedOnly versions of the System.Data.SQLite.dll file, but none seemed to work.
Can anyone please help me with this?
P.S: I know there are similar threads to this one, but please don't close this thread because none of the solutions have worked for me.
Thanks.
Here is the error:
NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.SQLiteDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. Ensure that the assembly SQLite.NET is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use <qualifyAssembly/> element in the application configuration file to specify the full name of the assembly.
at NHibernate.Driver.ReflectionBasedDriver..ctor(String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SQLiteDriver..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type)
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
--- End of inner exception stack trace ---
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at Employee.App.SessionProvider.get_Session() in C:\Users\Ako\documents\visual studio 2010\Projects\Employee\Employee.App\SessionProvider.cs:line 28
at Employee.App.EmployeeManager.get_Session() in C:\Users\Ako\documents\visual studio 2010\Projects\Employee\Employee.App\EmployeeManager.cs:line 14
at Employee.App.EmployeeManager.Save(Employee employee) in C:\Users\Ako\documents\visual studio 2010\Projects\Employee\Employee.App\EmployeeManager.cs:line 56
at Employee.App.frmMain.frmMain_Load(Object sender, EventArgs e) in C:\Users\Ako\documents\visual studio 2010\Projects\Employee\Employee.App\frmMain.cs:line 23
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The error appears to be with the driver creation, this suggests to me that the driver is not installed on your system correctly. I've just tested this and it works for me (ok I'm using monodevelop, not VS), I installed the Sqlite driver from here:
ADO.NET 2.0 Provider for SQLite
I then used this in my app.config file:
<session-factory>
<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SQLiteDriver</property>
<property name="connection.connection_string">Data Source=SimpleExample.sqlite;Version=3</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
<mapping assembly="SimpleExample" />
</session-factory>
it appears that the SQLite assembly is not loaded hence the error:
Could not create the driver from NHibernate.Driver.SQLiteDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. Ensure that the assembly SQLite.NET is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly.
you could preload the assembly using:
PreLoadAssembliesFromPath(AppDomain.CurrentDomain.BaseDirectory);
private static void PreLoadAssembliesFromPath(string p)
{
//S.O. NOTE: ELIDED - ALL EXCEPTION HANDLING FOR BREVITY
//get all .dll files from the specified path and load the lot
FileInfo[] files = null;
//you might not want recursion - handy for localised assemblies
//though especially.
files = new DirectoryInfo(p).GetFiles("*.dll",SearchOption.AllDirectories);
AssemblyName a = null;
string s = null;
foreach (var fi in files)
{
s = fi.FullName;
//now get the name of the assembly you've found, without loading it
//though (assuming .Net 2+ of course).
a = AssemblyName.GetAssemblyName(s);
//sanity check - make sure we don't already have an assembly loaded
//that, if this assembly name was passed to the loaded, would actually
//be resolved as that assembly. Might be unnecessary - but makes me
//happy :)
if (!AppDomain.CurrentDomain.GetAssemblies().Any(assembly =>
AssemblyName.ReferenceMatchesDefinition(a, assembly.GetName())))
{
//crucial - USE THE ASSEMBLY NAME.
//in a web app, this assembly will automatically be bound from the
//Asp.Net Temporary folder from where the site actually runs.
Assembly.Load(a);
}
}
}

NHibernate Version Issue

I'm having a go at getting a test project up and running. I've nabbed a load of code from this article.....
Fluent NHibernate Automap with NHibernate Facility in ASP.NET MVC
Problem is that I'm getting the following error....
Could not load file or assembly 'NHibernate, Version=3.0.0.1001,
Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
I've downloaded all the latest and greatest from NHibernate, Castle Project, and FluentNHibernate. I've looked at the version of the NHibernate.dll that I am referencing in the project and it's 3.0.0.400. Where and why is the solution complaining about 3.0.0.1001??????
For future use, I'd like to know how I find out what the problem is as well as the solution if possible.
Many thanks,
ETFairfax
MORE INFO.......
Exception Details: System.IO.FileLoadException: Could not load file or
assembly 'NHibernate, Version=3.0.0.1001, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line 45: if (container == null)
Line 46: {
Line 47: container = new WindsorContainer()
Line 48: .Install(
Line 49: Configuration.FromAppConfig(),
Source File: C:\Users\Public\Documents\TestCompany\Source\TestCompany.TestModule\MvcApplication2\Global.asax.cs Line: 47
Assembly Load Trace: The following information can be helpful to determine why the assembly 'NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' could not be loaded.
=== Pre-bind state information ===
LOG: User = ETFairfax-TestCompany\ETFairfax
LOG: DisplayName = NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
(Fully-specified)
LOG: Appbase = file:///C:/Users/Public/Documents/TestCompany/Source/TestCompany.TestModule/MvcApplication2/
LOG: Initial PrivatePath = C:\Users\Public\Documents\TestCompany\Source\TestCompany.TestModule\MvcApplication2\bin
Calling assembly : ClassLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Public\Documents\TestCompany\Source\TestCompany.TestModule\MvcApplication2\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Users/ETFairfax/AppData/Local/Temp/Temporary ASP.NET Files/root/25bf06cc/f1f41498/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Users/ETFairfax/AppData/Local/Temp/Temporary ASP.NET Files/root/25bf06cc/f1f41498/NHibernate/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Users/Public/Documents/TestCompany/Source/TestCompany.TestModule/MvcApplication2/bin/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Stack Trace:
[FileLoadException: Could not load file or assembly 'NHibernate, Version=3.0.0.1001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +64
System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58
System.Type.GetType(String typeName) +50
Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterDefaultConfigurationBuilder() +133
Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterComponents() +29
Castle.Facilities.NHibernateIntegration.NHibernateFacility.Init() +196
Castle.MicroKernel.Facilities.AbstractFacility.Init(IKernel kernel, IConfiguration facilityConfig) +61
Castle.MicroKernel.DefaultKernel.AddFacility(String key, IFacility facility) +182
Castle.Windsor.WindsorContainer.AddFacility(String key, IFacility facility) +49
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container) +242
Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) +89
Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers) +268
MvcApplication2.MvcApplication.InitializeWindsor() in C:\Users\Public\Documents\TestCompany\Source\TestCompany.TestModule\MvcApplication2\Global.asax.cs:47
MvcApplication2.MvcApplication.Application_Start() in C:\Users\Public\Documents\TestCompany\Source\TestCompany.TestModule\MvcApplication2\Global.asax.cs:62
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
Fluent was probably built with a later version than the NHibernate asselbly you downloaded.
Theres a bundle of Fluent/NH3.0 at Fluent NHibernate website.
http://fluentnhibernate.org/downloads

Castle Windsor & NHibernate facility: Value cannot be null. Parameter name: classType

Hi I am attempting to use Castle windsor Nhibernate Facility with fluent Nhibernate and Im getting the error above, as far as Im aware , I have followed the instructions on setting this up. Has anyone else seen this issue and maybe offer some advice? Thanks
Value cannot be null.
Parameter name: classType
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.ArgumentNullException: Value cannot be null.
Parameter name: classType
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: classType]
Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle, Boolean overwriteLifestyle) +191
Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType, LifestyleType lifestyle) +48
Castle.MicroKernel.DefaultKernel.AddComponent(String key, Type serviceType, Type classType) +45
Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterDefaultConfigurationBuilder() +154
Castle.Facilities.NHibernateIntegration.NHibernateFacility.RegisterComponents() +29
Castle.Facilities.NHibernateIntegration.NHibernateFacility.Init() +196
Castle.MicroKernel.Facilities.AbstractFacility.Init(IKernel kernel, IConfiguration facilityConfig) +61
Castle.MicroKernel.DefaultKernel.AddFacility(String key, IFacility facility) +182
Castle.Windsor.WindsorContainer.AddFacility(String key, IFacility facility) +49
Castle.Windsor.Installer.DefaultComponentInstaller.SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container) +242
Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) +89
Castle.Windsor.WindsorContainer.RunInstaller() +76
Castle.Windsor.WindsorContainer..ctor(IConfigurationInterpreter interpreter) +144
KingMaker.Web.Windsor.ContainerBuilder.Build(String config) +90
KingMaker.Web.MvcApplication.InitializeWindsor() +74
KingMaker.Web.MvcApplication.Application_Start() +55
Here is the facility xml facility
<facility
id="nhibernatefacility"
type="Castle.Facilities.NHibernateIntegration.NHibernateFacility, Castle.Facilities.NHibernateIntegration"
isWeb="true"
configurationBuilder="App.Web.Maps.FluentNHibernateConfigurationBuilder, App.Web">
<!-- configuration here is overriden by the FluentNHibernateConfigurationBuilder -->
<factory id="sessionFactory1">
<settings>
<item key="connection.provider">NHibernate.Connection.DriverConnectionProvider</item>
<item key="connection.driver_class">NHibernate.Driver.SqlClientDriver</item>
<item key="connection.connection_string">Data Source=localhost\sqlexpress;Initial Catalog=FIDPortal;Integrated Security=SSPI</item>
<item key="dialect">NHibernate.Dialect.MsSql2005Dialect</item>
<item key="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</item>
</settings>
<!-- <assemblies>-->
<!-- <assembly>Castle.Facilities.NHibernateIntegration.Tests</assembly>-->
<!-- </assemblies>-->
</factory>
</facility>
The stack trace says the type defined in the configurationBuilder attribute (FluentNHibernateConfigurationBuilder) is invalid or not found. Double-check the namespace and assembly name.