I have come across an issue with NHibernate.Search, where it all of a sudden stopped working, it cannot create files nor read the index-files at all.
我遇到过NHibernate.Search的一个问题,它突然停止工作,它根本无法创建文件或读取索引文件。
NHibernate seems to load it correctly:
NHibernate似乎正确加载它:
2009-01-20 17:37:17,751 [1] DEBUG NHibernate.Impl.SessionFactoryImpl - instantiating session factory with properties: {use_reflection_optimizer=True, hibernate.search.analyzer=Lucene.Net.Analysis.SimpleAnalyzer, Lucene.Net, hibernate.search.default.directory_provider=NHibernate.Search.Store.FSDirectoryProvider, NHibernate.Search, dialect=NHibernate.Dialect.PostgreSQL82Dialect, connection.driver_class=NHibernate.Driver.NpgsqlDriver, hibernate.search.default.indexBase.create=true, hibernate.search.default.indexBase=c:\temp\Lucene, connection.provider=NHibernate.Connection.DriverConnectionProvider, connection.connection_string_name=Dev}
But after that, nothing seems to work. No files are created, and c:\temp\Lucene is never created either. I have checked the permissions and I can't seem to find anything wrong with it.
但在那之后,似乎没有任何效果。没有创建文件,也从不创建c:\ temp \ Lucene。我已经检查了权限,我似乎无法找到任何错误。
This has become a dead end to me, and have no clue on how to proceed in my debugging. Any feedback is very much appreciated.
这已经成为我的死胡同,并且不知道如何进行我的调试。任何反馈都非常感谢。
Okay, updates:
I have figured out that FullTextIndexEventListener.Initialize(NHibernate.Cfg.Configuration cfg) is never invoked.
我已经发现从不调用FullTextIndexEventListener.Initialize(NHibernate.Cfg.Configuration cfg)。
I assumed that when adding the listener to NHibernate configuration would trigger it (since it implements NHibernate.Event.IInitializable), but when checking the source for NHibernate this doesn't seem to be the case?
我假设在向NHibernate配置添加监听器时会触发它(因为它实现了NHibernate.Event.IInitializable),但是当检查NHibernate的源代码时,情况似乎并非如此?
Odd thing is, that it works on my collegues dev-machine without this manual invokation. And we run the same source aswell as the same libraries.
奇怪的是,它可以在我的同事dev-machine上运行,而无需手动调用。我们运行相同的源以及相同的库。
1 个解决方案
#1
Okay, figured out that somehow, my machine has been speeding up the initialization-phase between ActiveRecord and NHibernate, meaning that since I register the EventListeners to NHibernate On_ApplicationStart(), NHibernate has already initialized, therefor never calling Initialize() in the listener.
好吧,想通了,不知何故,我的机器一直在加速ActiveRecord和NHibernate之间的初始化阶段,这意味着由于我将EventListeners注册到NHibernate On_ApplicationStart(),NHibernate已经初始化,因此永远不会在监听器中调用Initialize()。
On my collegues computer, NHibernate hasn't yet initialized when it registers the eventlisteners, therefor invoking Initialize.
在我的同事计算机上,NHibernate在注册eventlisteners时尚未初始化,因此调用Initialize。
This is somewhat a flaw in the ActiveRecord design, since I need to initialize AR before I can register something into NHibernate. Sort of like a catch 22.
这在ActiveRecord设计中有些瑕疵,因为我需要初始化AR才能在NHibernate中注册一些内容。有点像捕获22。
Hopefully someone will find this info useful.
希望有人会发现此信息有用。
#1
Okay, figured out that somehow, my machine has been speeding up the initialization-phase between ActiveRecord and NHibernate, meaning that since I register the EventListeners to NHibernate On_ApplicationStart(), NHibernate has already initialized, therefor never calling Initialize() in the listener.
好吧,想通了,不知何故,我的机器一直在加速ActiveRecord和NHibernate之间的初始化阶段,这意味着由于我将EventListeners注册到NHibernate On_ApplicationStart(),NHibernate已经初始化,因此永远不会在监听器中调用Initialize()。
On my collegues computer, NHibernate hasn't yet initialized when it registers the eventlisteners, therefor invoking Initialize.
在我的同事计算机上,NHibernate在注册eventlisteners时尚未初始化,因此调用Initialize。
This is somewhat a flaw in the ActiveRecord design, since I need to initialize AR before I can register something into NHibernate. Sort of like a catch 22.
这在ActiveRecord设计中有些瑕疵,因为我需要初始化AR才能在NHibernate中注册一些内容。有点像捕获22。
Hopefully someone will find this info useful.
希望有人会发现此信息有用。