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.  [ 5 posts ] 
Author Message
 Post subject: interesting second level cache problem
PostPosted: Thu Nov 03, 2005 2:05 pm 
Beginner
Beginner

Joined: Tue Aug 23, 2005 8:15 am
Posts: 45
My solution includes 2 ASP.NET project:
- user interface pages (1)
- Web Service (2)

Both projects uses NHibernate.
Project (1) includes wrapper class session.cs .
It create configuration, session factory and session.

Example of one of method of this class is:
private static ISessionFactory Factory
{
get
{
if( _factory == null )
{
Configuration config = SessionManager.Configuration;
lock( _locker )
{
if( _factory == null )
_factory = config.BuildSessionFactory();
}
}
return _factory;
}
}

I access NHibernate session in both projects
through this class.

Project (2) contains reference to project (1)
(it needs it to access session.cs class)

The problem is very interesting.

If and only if I enable second-level cache
in nhibernate settings in web.config of project (1)
the following error appears here
"_factory = config.BuildSessionFactory();"
when I go to web service:

could not instantiate CacheProvider: NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache --> Specified cast is not valid.

What is the problem?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 06, 2005 10:16 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Can you post the whole exception information?
You may also try to use this cache in a simpler situation to isolate the problem...

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject: exception info
PostPosted: Mon Nov 07, 2005 12:05 pm 
Beginner
Beginner

Joined: Tue Aug 23, 2005 8:15 am
Posts: 45
NHibernate.HibernateException: could not instantiate CacheProvider: NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache ---> System.InvalidCastException: Specified cast is not valid.
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary properties)
--- End of inner exception stack trace ---
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary properties)
at NHibernate.Cfg.Configuration.BuildSessionFactory()

In case of using SysCache for only one ASP.NET project
all worked fine.

By the way for some time the problem dissapeared when I
replaced NHibernate (and all other dlls it uses) for release 1.0.0.
But at the moment I see the same error.


KPixel wrote:
Can you post the whole exception information?
You may also try to use this cache in a simpler situation to isolate the problem...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 07, 2005 12:55 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Check that you use matching versions of NHibernate and NHibernateContrib dlls.


Top
 Profile  
 
 Post subject: already checked
PostPosted: Tue Nov 08, 2005 9:37 am 
Beginner
Beginner

Joined: Tue Aug 23, 2005 8:15 am
Posts: 45
sergey wrote:
Check that you use matching versions of NHibernate and NHibernateContrib dlls.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.