"Could not create the driver from NHibernate.JetDriver.JetDriver" help?

434 views
Skip to first unread message

isteve

unread,
Jun 25, 2008, 5:45:02 PM6/25/08
to nhusers
This is my first time using NHibernate so forgive me if this is an
obvious error, hopefully it is. I am having trouble connecting to a ms
access 2003/2007 database. The log from the unit test comes out as
follows.

------ Test started: Assembly: SiteMap.Tests.dll ------

TestCase 'SiteMapDataProviderTests.CanGetNodeById' failed:
NHibernate.HibernateException: Could not create the driver from
NHibernate.JetDriver.JetDriver, NHibernate.JetDriver. --->
System.IO.FileNotFoundException: Could not load file or assembly
'NHibernate.JetDriver' or one of its dependencies. The system cannot
find the file specified.
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, Assembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at
NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError)
at NHibernate.Util.ReflectHelper.ClassForName(String name)
at
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary
settings)
--- End of inner exception stack trace ---
at
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary
settings)
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary
settings)
at
NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary
settings)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary
properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
I:\Steve\Documents\Visual Studio 2008\Projects\SiteMap
\SiteMap.DataAccess\SiteMapDataProvider.cs(19,0): at
SiteMap.DataAccess.SiteMapDataProvider.GetNodeById(Int32 id)
I:\Steve\Documents\Visual Studio 2008\Projects\SiteMap\SiteMap.Tests
\SiteMapDataProviderTests.cs(19,0): at
SiteMap.Tests.SiteMapDataProviderTests.CanGetNodeById()

0 passed, 1 failed, 0 skipped, took 3.76 seconds.

My hibernate.cfg.xml file looks like this

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>

<property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
<property name="dialect">NHibernate.JetDriver.JetDialect,
NHibernate.JetDriver</property>
<property
name="connection.driver_class">NHibernate.JetDriver.JetDriver,
NHibernate.JetDriver</property>
<property
name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.
4.0;Data Source=I:\Steve\Documents\Visual Studio 2008\Projects\SiteMap
\SiteMap.mdb</property>

<property name="show_sql">true</property>

<mapping assembly="SiteMap.Core"></mapping>
</session-factory>

</hibernate-configuration>

I am referencing the NHibernate.JetDriver.dll found in
NHibernateContrib.

Any ideas?

Steve

James Kovacs

unread,
Jun 26, 2008, 11:28:32 AM6/26/08
to nhu...@googlegroups.com
Turn on the Assembly Binding Log Viewer (Fuslogvw.exe) found in the .NET Framework SDK. (My install path is C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin. You may also find it installed with Visual Studio under the SDK directory.) It will give you full diagnostics regarding assembly probing and resolution. You can find information on how to use it here:

http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx

Post the binding log for the NHibernate.JetDriver.dll here and we can give you a hand sorting out the problem.

James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

isteve

unread,
Jun 26, 2008, 4:20:38 PM6/26/08
to nhusers
Hi James

The log file for NHibernate said this
LOG: Assembly Name is: NHibernate, Version=1.2.1.4000,
Culture=neutral, PublicKeyToken=aa95f207798dfdb4
WRN: Comparing the assembly name resulted in the mismatch: Minor
Version
ERR: The assembly reference did not match the assembly definition
found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing
terminated.

The problem was with the file version, I was using NHibernate.dll and
NHibernate.JetDriver.dll version 1.2.1.4000. I downloaded the
NHibernateContrib trunk, compiled it to get the latest version
(2.0.0.1001), copied the files, updated the references and it worked,
Thanks!

Steve

James Kovacs

unread,
Jun 26, 2008, 7:11:29 PM6/26/08
to nhu...@googlegroups.com
Glad you got it running. Right now the team is focused on getting NHibernate v2 out the door and there isn't a compiled version of NHContrib available that is compatible with NH2. So you have to compile it yourself. Once NH2 goes gold, the team will put out an official version of NHContrib that is compatible with NH2.


James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP - C# Architecture
http://www.jameskovacs.com
jko...@post.harvard.edu
403-397-3177 (mobile)

Reply all
Reply to author
Forward
0 new messages