-->
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.  [ 2 posts ] 
Author Message
 Post subject: Setting up JBossCache 2nd level cache with Hibernate 3
PostPosted: Fri Apr 21, 2006 8:09 am 
Newbie

Joined: Fri Mar 03, 2006 8:45 am
Posts: 2
Hi there,

I'm trying to setup a 2nd level cache using JBossCache. I have a web application running under JBoss 4.0.3 and another application running on a different machine. Both applications have the potential to update the database. I am using the org.hibernate.cache.JndiBoundTreeCacheProvider
tree cache in my hibernate.cfg.xml file, and am defining the mbean in the jboss-service.xml file.

Upon startup, JBoss is correctly starting the TreeCache MBean, however hibernate is failing to find it when creating the Session due to a JNDI namespace issue. I noticed that the org.hibernate.cfg.Environment class has a CACHE_NAMESPACE property on it, and thinking this would work in a similar way to the TRANSACTION_MANAGER_STRATEGY property, I tried to set:

<property name="cache.jndi">jboss.cache:service=TreeCache</property>

in my hibernate.cfg.xml file. However, this complained that the hibernate.cfg file was now invalid, so that is obviously not the way to do it.

Without that property set I get the following error occur when I start up JBoss:
Quote:
org.hibernate.cache.CacheException: No JNDI namespace specified for cache
at org.hibernate.cache.AbstractJndiBoundCacheProvider.start(AbstractJndiBoundCacheProvider.java:44)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:173)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)


My hibernate.cfg.xml file can be found here

My jboss-service.xml file can be found here

A full stack trace of the error can be found here

I have also tried using the org.jboss.hibernate.cache.DeployedTreeCacheProvider in the hibernate.cfg.xml file instead of the JndiBoundTreeCacheProvider, but doing so causes the following ClassCastException



Can someone please tell me how I get my cache working either by letting me know where I specify the JNDI namespace when using the JndiBoundTreeCacheProvider, or tell me what I am doing wrong when using the DeployedTreeCacheProvider.

Many thanks in advance,

Ben


Hibernate version:
Hibernate-Version: 3.1.3


Name and version of the database you are using:
version=Oracle 10g
name=MM


Top
 Profile  
 
 Post subject: Setting up JBossCache 2nd level cache with Hibernate 3
PostPosted: Mon Sep 25, 2006 6:27 am 
Newbie

Joined: Tue Oct 05, 2004 9:21 am
Posts: 7
Location: Dublin, Ireland
Hi Ben,

I am experiencing the same problem. Did you get a resolution on this issue?

Thanks,
Barbara


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