View Full Version : Spring + NHibernate + Spring.WindowsService = :(

02-09-2007, 04:55 PM
this issue that i am facing is very similar to the issue raised in this post:

but with the difference that I am using the Spring.Services.Windows.Service.Process.exe to host my dll and run it as a service.

The problem is that I would like the spring framework to use version of log4net to avoid any conflicts with NHibernate.

So, in my Spring.Services.WindowsService.Process.exe.config file I have added the following lines:

<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />

<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter , Common.Logging.Log4Net">
<!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL-->
<!-- otherwise BasicConfigurer.Configure is used -->
<!-- log4net configuration file is specified with key configFile-->
<arg key="configType" value="INLINE" />

the problem is that when i start the spring service, it fails due to a file not found exception. The Spring.Services.WindowsService.Process.exe is looking for a particular version of log4net and appears to be ignoring the changes i put in the config file above.

Can anybody help?!?!?!?!?

BTW - can somebody explain what the different values for configType actually mean..


Erich Eichinger
02-09-2007, 06:00 PM
Hi Rupert,

most likely you are not using a recent build of Spring.Services.Windows.Service.Process.exe and your version is still linked against old log4net 1.2.9

To rebuild the .exe please get the latest sources from CVS or via the nightly builds area and open the solution file in

springnet\Spring.Net\examples\Spring\Spring.Exampl es.WindowsService\Spring.Examples.WindowsService.2 005.sln

after building the solution you should find the .exe in

springnet\Spring.Net\examples\Spring\Spring.Exampl es.WindowsService\ServiceFakedInstDir\

the new executable will be linked against Common.Logging only and your setup should work.

Regarding "configType"-parameters:

INLINE will simply call XmlConfigurator.Configure()
EXTERNAL expects log4net being configured somewhere else in your code and does nothing.

FILE, FILE-WATCH: will call XmlConfigurator.Configure( FileInfo ) using the filename passed by "configFile" parameter.

hope this helps,

02-12-2007, 10:44 AM
Hi Erich,
Thanks for the reply. It now works...

I had the latest source code from the nightly builds but didn't build the solution correctly.

I didn't realise there was a Windows Service solution in the examples directory and had edited the main Spring 1.1 solution to include the Spring.Services.WindowsService projects... All had built successfully but it didn't work correctly.

Building the solution from the examples directory worked first time.

Thanks again,