Лето Сессии Nhibernate 01, почему я получаю NHibernate. Байт-код. ProxyFactoryFactoryNotConfiguredException?

Используйте java.beans.XMLDecoder , часть базового Java SE с тех пор 1.4.

XMLDecoder input = new XMLDecoder(new FileInputStream("some/path.xml"));
MyConfig config = (MyConfig) input.readObject();
input.close();

Это легко к , пишут конфигурационные файлы рукой или используют соответствие XMLEncoder с некоторой установкой для записи новых объектов во времени выполнения.

12
задан mlusby 27 October 2009 в 20:47
поделиться

3 ответа

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

12
ответ дан 2 December 2019 в 05:54
поделиться

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.

14
ответ дан 2 December 2019 в 05:54
поделиться

Это был очень полезный ответ. Я загрузил последнюю версию NHibernate (2.1.1.GA) с выпуском Gallio MBUnit (3.1.0.0), но у меня начались проблемы, когда пришло время запускать тесты. Добавление четырех файлов, предложенных mlusby, и дополнительной строки в файл hibernate.cfg.xml решило мою проблему. Это было единственное рабочее решение, которое я нашел в Интернете. Спасибо!

0
ответ дан 2 December 2019 в 05:54
поделиться
Другие вопросы по тегам:

Похожие вопросы: