-->
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.  [ 3 posts ] 
Author Message
 Post subject: System.TypeInitializationException:
PostPosted: Sun Jul 29, 2007 12:06 pm 
Newbie

Joined: Sun Jul 29, 2007 10:58 am
Posts: 2
Hi, This has been my first project to use NHibernate and I was having no problems locally until I tried publishing the project to my webspace. When I do so I keep getting the following exception. Can anyone please help me figure out how to resolve this.

Full stack trace of any exception that occurs:
System.TypeInitializationException: The type initializer for 'DAL.NHibernateHelper' threw an exception. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Reflection.Emit.DynamicMethod.PerformSecurityCheck(Type owner, StackCrawlMark& stackMark, Boolean skipVisibility) at System.Reflection.Emit.DynamicMethod..ctor(String name, Type returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility) at NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateDynamicMethod(Type returnType, Type[] argumentTypes) at NHibernate.Bytecode.Lightweight.ReflectionOptimizer.GenerateGetPropertyValuesMethod(IGetter[] getters) at NHibernate.Bytecode.Lightweight.ReflectionOptimizer..ctor(Type mappedType, IGetter[] getters, ISetter[] setters) at NHibernate.Bytecode.Lightweight.BytecodeProviderImpl.GetReflectionOptimizer(Type mappedClass, IGetter[] getters, ISetter[] setters) at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory) at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping) at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg) at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings) at NHibernate.Cfg.Configuration.BuildSessionFactory() at DAL.NHibernateHelper..cctor() in C:\Users\John Cleary\Documents\Visual Studio 2005\Projects\EAR_DAL\EAR_DAL\NHibernateHelper.cs:line 30 The action that failed was: Demand The type of the first permission that failed was: System.Security.Permissions.ReflectionPermission The Zone of the assembly that failed was: MyComputer --- End of inner exception stack trace --- at DAL.NHibernateHelper.GetSession() at DAL.ClientCaseNotes.ClientCaseNotesForm.Load(Int32 id) in C:\Users\John Cleary\Documents\Visual Studio 2005\Projects\EAR_DAL\EAR_DAL\ClientCaseNotes\ClientCaseNotesForm.cs:line 42 at CaseNotes.LoadForm(String id)



Thanks,
John.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 30, 2007 10:46 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
Have you tried turning off reflection optimisation? Set hibernate.use_reflection_optimizer to false in your config.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 6:13 pm 
Newbie

Joined: Sun Jul 29, 2007 10:58 am
Posts: 2
Yeah I figured that out after some serious googling. Was in a bit of a panic there as the application was due the following day. They really should make that more clear in the documation or default it to false so that it will run under medium security.


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

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.