1

I’ve run into what appears to be an NHibernate config problem. Basically, I ran up a simple proof of concept persistence integration test using NUnit, the test simply queries an Oracle database and successfully returns the last record received by the underlying table. However, when the assemblies are taken out of the NUnit test environment and deployed as they would be for an actual application build, my call for an NHibernate session results in a TypeInitializationException whilst executing the code line:

sessionFactory = New Configuration().Configure().BuildSessionFactory()

The application is a vb.net console app running against an Oracle 9.2 database, using a ‘coding framework’ published on the web by Bill McCafferty entitled 'NHibernate Best Practices with ASP.NET' (pre S#harp Architecture). I am running version 2.1.2.4000 of NHibernate.

Any assistance much appreciated.

Kind Regards

Paul J.

1
  • Please show us your nhibernate config file. Commented Mar 17, 2010 at 13:40

1 Answer 1

2

You will get this exception if your nhibernate config file is broken, or if any of NHibernate's dependencies are missing (eg log4net).

The stacktrace will usually tell you what the problem is. Without seeing your config I can only guess, but some possible problems are:

  • incorrect namespace
  • config contains invalid elements or attributes
  • incorrect property names

These errors are easy to make if your config file is based on out of date documentation. For the current version, the XML configuration file is documented here.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Lachlan appreciate your repsonse. Actually solved the problem, the Log4net.dll was not being generated in the output folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.