The formatting is getting mucked up in the mail, but there appears to be a ThreadAbortException as the innermost exception... Seems weird. Does it happen every time the timer triggers?
/Oskar 2010/10/15 Sacha <[email protected]>: > I have a Windows service which has a timer and in the timer_Elapsed > event handler a method from another component will be called which is > supposed to look into db and read or update some records. > The timer Elapsed event is getting fired every 2 minutes.I used > nhibernate for data access and all the nhibernate and db related > configuration code is done in the component and windows service has a > reference to the component.When I run the method from unit test it is > working fine which means the configurations and mappings are correct, > but from windows service I get this exception: > > > FluentNHibernate.Cfg.FluentConfigurationException was caught > Message="An invalid or incomplete configuration was used while > creating a SessionFactory. Check PotentialReasons collection, and > InnerException for more detail.\r\n\r\n" > Source="FluentNHibernate" > StackTrace: > at > FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in d: > \Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line > 121 > InnerException: NHibernate.MappingException > Message="Could not configure datastore from input stream > (XmlDocument)" > Source="NHibernate" > StackTrace: > at NHibernate.Cfg.Configuration.LogAndThrow(Exception > exception) > at NHibernate.Cfg.Configuration.AddInputStream(Stream > xmlInputStream, String name) > at > NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc, String name) > at > NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc) > at > FluentNHibernate.PersistenceModel.Configure(Configuration cfg) in d: > \Builds\FluentNH\src\FluentNHibernate\PersistenceModel.cs:line 265 > at > FluentNHibernate.Cfg.FluentMappingsContainer.Apply(Configuration cfg) > in d:\Builds\FluentNH\src\FluentNHibernate\Cfg > \FluentMappingsContainer.cs:line 141 > at > FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg) in > d:\Builds\FluentNH\src\FluentNHibernate\Cfg > \MappingConfiguration.cs:line 64 > at > FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in d: > \Builds\FluentNH\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line > 112 > InnerException: System.TypeInitializationException > Message="The type initializer for > 'NHibernate.Util.TypeNameParser' threw an exception." > Source="NHibernate" > TypeName="NHibernate.Util.TypeNameParser" > StackTrace: > at NHibernate.Util.TypeNameParser.Parse(String > type, String defaultNamespace, String defaultAssembly) > at > NHibernate.Cfg.ClassExtractor.ClassEntry..ctor(String extends, String > className, String entityName, String assembly, String namespace) > at > NHibernate.Cfg.ClassExtractor.GetClassEntries(XmlDocument document) > at > NHibernate.Cfg.MappingsQueue.AddDocument(NamedXmlDocument document) > at > NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument > document) > at > NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String > name) > at > NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, > String name) > InnerException: System.Threading.ThreadAbortException > Message="Exception of type > 'System.Threading.ThreadAbortException' was thrown." > InnerException: > > Here is the code I have in the service : > > public InitiatorService() > { > InitializeComponent(); > } > > protected override void OnStart(string[] args) > { > timer1.Enabled = true; > } > > protected override void OnStop() > { > } > private void timer1_Elapsed(object sender, > System.Timers.ElapsedEventArgs e) > { > lock (processLock) > { > DoWorkComponent component= new DoWorkComponent (); > component.DoWorkMethod(); > } > } > > In the DoWorkComponent : > > public void DoWorkMethod() > { > try > { > ISession session =GetSession(); > ITransaction transaction = session.BeginTransaction(); > > //code to do actions > > session.Flush(); > transaction.Commit(); > session.Close(); } > catch (Exception ex) > { > throw new InvalidOperationException(ex.Message); > } > } > > Please let me know if this is a correct practice and how I can fix > this problem. > > The nhibernate version I am using is 2.1.2.4000 and I set CallContext > to thread_static. > > Thanks in Advance, > > Sacha > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
