Castle ActiveRecord – Exception : The ProxyFactoryFactory was not configured
I’ve just updated to the latest version of the Castle stack and got hit with this exception:
The ProxyFactoryFactory was not configured. Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers. Example: NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu Example: NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle
Turns out the NHibernate config has changed and as the exception says you must now specify a factory class.
To fix the exception add a new line to your active record facility config:
<facility id="activerecord.facility" isweb="true" type="Castle.Facilities.ActiveRecordIntegration.ActiveRecordFacility, Castle.Facilities.ActiveRecordIntegration">
<assemblies>
<item>Nu.Core</item>
</assemblies>
<config>
<add value="false" key="cache.use_query_cache" />
<add value="ReadCommitted" key="connection.isolation" />
<add value="false" key="show_sql" />
<add value="NHibernate.Dialect.SQLiteDialect" key="dialect" />
<add value="NHibernate.Driver.SQLite20Driver" key="connection.driver_class" />
<add value="true=1;false=0" key="query.substitutions" />
<add value="#{ConnectionString}" key="connection.connection_string" />
<add value="NHibernate.Connection.DriverConnectionProvider" key="connection.provider" />
<add value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" key="proxyfactory.factory_class" />
</config>
</facility>
Then add a reference in your project to NHibernate.ByteCode.Castle.dll.
I don’t know much about AR config, since I only switched from RC2 to trunk today, but putting the whole database config stuff outside the facility section worked for me where putting it inside (like you did) didn’t … Thanks for posting!
Flominator
27 Jan 09 at 10:35 am
Then add a reference in your project to NHibernate.ByteCode.Castle.dll.
from where did i get this dll
meetuchoudhary
10 Jun 09 at 9:09 am
If you have downloaded and built from the trunk you’ll find the dll in:
build\net-3.5\release
justinram
10 Jun 09 at 9:50 am
i have downloaded it but i didn’t found that at that location you said
meetuchoudhary
10 Jun 09 at 10:24 am
can you please let mme know from where to download i am new to nhibernate. and what is this trunk
meetuchoudhary
10 Jun 09 at 10:40 am
I’m guessing you haven’t checked out the castle source and ran a build. To save you the hassle you can download the latest build from:
http://www.castleproject.org:8090/
The current latest release build: http://www.castleproject.org:8090/repository/download/bt6/131:id/castleproject-1.1-build_1152-net-3.5-release.zip contains a bin folder which contains a external-dependencies.zip file which contains the NHibernate.ByteCode.Castle.dll.
justinram
10 Jun 09 at 10:49 am
Thanks for the response.
but before getting in depth of this I would like to clarify my problem please have a look on this conversation http://forums.asp.net/t/1432123.aspx and let me know is NHibernate is the solution to this.
meetuchoudhary
10 Jun 09 at 11:09 am
Sorry I don’t I understand the problem so can’t really comment.
justinram
10 Jun 09 at 11:29 am
Basically I want to create a project (whose output will be a DLL) which accepts the sql query in any kind of parameters for any database by the programer who uses that dll but the database will be opted by the end user. now the work of this dll will be it will trace the database type (SQL,Mysql,oracle etc.) opted by the end user. and then using the parametrs passed by the programmer fires the query on that type of database. and returns the resultset to the programmer for use. hope i my problem is clear to you.
meetuchoudhary
10 Jun 09 at 11:34 am
Sorry still not really clear.
NHibernate will work with multiple database types (https://www.hibernate.org/361.html) you can query NHibernate using HQL (which is very similar syntax to SQL), NHibernate will then convert the HQL to a SQL dialect which the underlying database type understands.
Not sure if that is any help to you, best of luck!
justinram
10 Jun 09 at 11:50 am
can i have your mail id or gmailid to chat with you. if you don’t mind or i should continue here?
meetuchoudhary
10 Jun 09 at 12:02 pm
I’m not sure I can help but feel free to continue here.
justinram
10 Jun 09 at 2:31 pm
Can you please give me the link from where i can get a working example to develop my first application using NHibernate
meetuchoudhary
11 Jun 09 at 5:45 am
There is a good series of web casts at http://www.summerofnhibernate.com/
A good book might help http://www.manning.com/kuate/
Any questions I would direct at http://groups.google.com/group/nhusers
Other than that you could always Google nhibernate getting started… http://www.google.co.uk/search?q=nhibernate+getting+started
justinram
11 Jun 09 at 9:07 am
Thanks for the response.. i will try it…
meetuchoudhary
11 Jun 09 at 9:15 am
[...] http://justinramel.com/2009/01/23/castle-activerecord-exception-the-proxyfactoryfactory-was-not-conf... Possibly related posts: (automatically generated)Handling Exceptions In Spring MVC – Part 2 Comments (15) [...]
Castle ActiveRecord – Exception : The ProxyFactoryFactory was not configured « just in ram
4 Nov 09 at 11:12 pm
Thanks. That worked fine for me
Gonzalo
5 Feb 10 at 3:27 am
Thanks – this worked for me!
Regards,
Craig
Craig Harvey
9 Mar 10 at 9:43 am