mlusby
mlusby

Reputation: 661

Summer of Nhibernate Session 01, why am I getting NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException?

I'm completely new to NHibernate, following along on the screencast at www.summerofnhibernate.com, which is awesome. Towards the end of the presentation, the unit test is supposed to pass, but for me it says:

NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException: The ProxyFactoryFactory was not configured.

What am I doing wrong?

Upvotes: 12

Views: 3054

Answers (3)

user205027
user205027

Reputation: 1

This was a very helpful answer. I downloaded the latest version of NHibernate (2.1.1.GA) with the Gallio release of MBUnit (3.1.0.0), but started running into problems when it became time to run the tests. Adding the four files suggested by mlusby and the extra line into the hibernate.cfg.xml file solved my problem. This was the only working solution I found on the internet. Thanks!

Upvotes: 0

mlusby
mlusby

Reputation: 661

I asked this because it took me a lot longer to find the answer than I would have liked. If I'm leading other newbies astray, please correct me.

Apparently since the making of the screencast, NHibernate now requires you to specify the ProxyFactoryFactory, which I don't know what that is yet, and if you're searching for this, you probably don't either.

Add this to your hibernate.cfg.xml:

<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

Also add these files to your lib\NHibernate folder

NHibernate.ByteCode.Castle.dll

Castle.Core.dll
Castle.Core.xml
Castle.DynamicProxy2.dll
Castle.DynamicProxy2.xml

And add a reference to NHibernate.ByteCode.Castle.dll to your DataAccessLayerTest project

I may be way off, but after a couple hours of digging, I'm able to progress to the next screencast, and I hope you are too.

Upvotes: 14

Andriy Volkov
Andriy Volkov

Reputation: 18923

I bet you use NH 2.1 while the screencast used 2.0.

In 2.1 you have to set proxyfactory.factory_class to one of NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.LinFu.ProxyFactoryFactory or NHibernate.ByteCode.Spring.ProxyFactoryFactor

Upvotes: 12

Related Questions