These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using NHibernate from PowerShell
PostPosted: Thu Apr 16, 2009 4:13 am 
Newbie

Joined: Wed May 31, 2006 8:51 am
Posts: 4
Hi!

I'm trying to use NHibernate 2.1.0.Alpha2 from a PowerShell script to do schema exports, test data generation, etc. A great idea, if I only could get it working...

Here's a minimal script that gives me my problem:

[reflection.assembly]::loadfile('C:\TFS\Lernia\Intäktsverktyget\Libs\log4net.dll')
[reflection.assembly]::loadfile('C:\TFS\Lernia\Intäktsverktyget\Libs\NHibernate.dll')
$config = new-object NHibernate.Cfg.Configuration

The exception I get is this:

------------------------------------
System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "0" argument(s): "The type initializer for 'NHibernat
e.Cfg.Configuration' threw an exception." ---> System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Configuration' t
hrew an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, Public
KeyToken=1b44e1d426115821' or one of its dependencies. The system cannot find the file specified.
File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
at NHibernate.Cfg.Configuration..cctor()
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type)
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Management.Automation.DotNetAdapter.AuxiliarConstructorInvoke(ConstructorInfo constructor, Object[] arguments, MethodInformatio
n methodInformation, Object[] originalArguments)
--- End of inner exception stack trace ---
at System.Management.Automation.DotNetAdapter.AuxiliarConstructorInvoke(ConstructorInfo constructor, Object[] arguments, MethodInformatio
n methodInformation, Object[] originalArguments)
at System.Management.Automation.DotNetAdapter.ConstructorInvokeDotNet(ConstructorInfo[] constructors, Object[] arguments)
at Microsoft.PowerShell.Commands.NewObjectCommand.CallConstructor(ConstructorInfo[] constructors, Object[] args)
------------------------------------

So it seems that the first time NHibernate wants to use log4net I get this exception that something cannot be found. I have tried explicitly loading all DLLs that log4net references, but that doesn't help.

Any ideas of how to fix this, or debug the problem, are most appreciated!

Cheers,

Emil


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.