开发者

Unable to load proxy factory factory exception

开发者 https://www.devze.com 2023-04-01 16:41 出处:网络
I am having this annoying error while running my Nhibernate project. It was running okey and all of a sudden it just start asking for a file in this path \"d:\\CSharp\\NH\\NH\\nhibernate\\src\\NHibern

I am having this annoying error while running my Nhibernate project. It was running okey and all of a sudden it just start asking for a file in this path "d:\CSharp\NH\NH\nhibernate\src\NHibernate\Bytecode\AbstractBytecodeProvider.cs" and when cancel, it throws an exception saying it says Unabl开发者_运维问答e to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.

Solution: Confirm that your deployment folder contains one of the following assemblies: NHibernate.ByteCode.LinFu.dll NHibernate.ByteCode.Castle.dll

It is become frustrating for me... need help please -:)


Make sure that you have following dlls copied to the output folder and loaded by your process:

  • NHibernate.ByteCode.Castle.dll
  • Castle.Core.dll
  • NHibernate.dll
  • Iesi.Collections.dll
  • log4net.dll

And your NHibernate configuration has this line:

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

As an option, you can try to upgrade to latest version of NHibernate - 3.2. They have a built in proxy generator so it should be simpler for you. You will not need these additional dlls. Just remove the config line above if you use NHibernate 3.2.

If for some reasons you can not upgrade to 3.2 you may consider using different byte code providers. NHibernate supports 3 of them out of the box. Try LinFu or Spring:

  • NHibernate.ByteCode.Castle.ProxyFactoryFactory
  • NHibernate.ByteCode.LinFu.ProxyFactoryFactory
  • NHibernate.ByteCode.Spring.ProxyFactoryFactor


Upgrade to the latest version and you will not need an external proxyfactory anymore.

0

精彩评论

暂无评论...
验证码 换一张
取 消