-->
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.  [ 7 posts ] 
Author Message
 Post subject: treecache.xml
PostPosted: Mon Nov 22, 2004 8:16 pm 
Newbie

Joined: Wed Nov 10, 2004 9:27 pm
Posts: 4
I am using JBoss 3.2.6 and Hibernate 2.1.

I am deploying hibernate using an MBean and have the following attributes specified in jboss-service.xml. The jboss-service.xml is packaged in a SAR file, which is then deployed through an EAR file.

<attribute name="CacheProvider">net.sf.hibernate.cache.TreeCacheProvider</attribute>
<attribute name="UseQueryCache">false</attribute>

Where do I place the treecache.xml file that came along with Hibernate?

- Bala


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 22, 2004 10:08 pm 
Newbie

Joined: Wed Nov 10, 2004 9:27 pm
Posts: 4
A little more info to my above question. I placed treecache.xml in the deploy/ directory and received the following error:

Packages waiting for a deployer:
org.jboss.deployment.DeploymentInfo@1f1a186b { url=file:/C:/DEV/ren/jBoss/server
/all/deploy/treecache.xml }
deployer: null
status: null
state: INIT_WAITING_DEPLOYER
watch: file:/C:/DEV/ren/jBoss/server/all/deploy/treecache.xml
lastDeployed: 1101175363806
lastModified: 1101175363796
mbeans:

Incompletely deployed packages:
org.jboss.deployment.DeploymentInfo@1f1a186b { url=file:/C:/DEV/ren/jBoss/server
/all/deploy/treecache.xml }
deployer: null
status: null
state: INIT_WAITING_DEPLOYER
watch: file:/C:/DEV/ren/jBoss/server/all/deploy/treecache.xml
lastDeployed: 1101175363806
lastModified: 1101175363796
mbeans:

- Bala


Top
 Profile  
 
 Post subject: Re: treecache.xml
PostPosted: Tue Nov 23, 2004 5:18 am 
Beginner
Beginner

Joined: Tue Oct 26, 2004 12:45 pm
Posts: 43
Location: Israel
bsaravan wrote:
Where do I place the treecache.xml file that came along with Hibernate?


I am not sure if it will solve your problem, but i put it in the 'conf' directory (where the main jboss-service.xml is), and it loaded well (i think, didn't check, but didn't got an exception).

hope it helps,
Jus.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 02, 2004 6:33 am 
Senior
Senior

Joined: Fri May 14, 2004 9:37 am
Posts: 122
Location: Cologne, Germany
Hi there,

I put it into the hibernate archive that should be deployed. But carefull you have to restart jboss for a deployment if you are not using a custom Treecacheprovider. (Slightly modified Hibernate Code using a JNDI lookup instead of looking for a file)
So Issahars solution is a bit better imho.

_________________
regards

Olaf

vote if it helped


Top
 Profile  
 
 Post subject: Re: treecache.xml
PostPosted: Mon Nov 21, 2005 7:16 am 
Newbie

Joined: Mon Nov 21, 2005 7:07 am
Posts: 1
Location: Chennai
bsaravan wrote:
I am using JBoss 3.2.6 and Hibernate 2.1.

I am deploying hibernate using an MBean and have the following attributes specified in jboss-service.xml. The jboss-service.xml is packaged in a SAR file, which is then deployed through an EAR file.

<attribute name="CacheProvider">net.sf.hibernate.cache.TreeCacheProvider</attribute>
<attribute name="UseQueryCache">false</attribute>

Where do I place the treecache.xml file that came along with Hibernate?

- Bala



Hi,

I am a beginner, Could you please send me the steps on how to use TreeCache. It will be great help. Thanks in advance.

Vnay


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 5:46 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Since you are already using MBean services - TreeCache itself is a MBean service, so simply put contents of treecache.xml in your jboss-service.xml.
Then instead of using TreeCacheProvider, use this one:

Code:
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.hibernate.cache;

import java.util.Properties;
import javax.management.MBeanServer;
import javax.management.ObjectName;

import org.hibernate.cache.Cache;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.CacheProvider;
import org.jboss.cache.TreeCache;
import org.jboss.cache.TreeCacheMBean;
import org.jboss.mx.util.MBeanProxy;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.tm.TxManager;

/**
* A Hibernate CacheProvider implementation which knows how to
* obtain a deployed JBossCache via its JMX ObjectName.
*
* @version <tt>$Revision: 1.6 $</tt>
* @author <a href="mailto:steve@hibernate.org">Steve Ebersole</a>
*/
public class DeployedTreeCacheProvider implements CacheProvider
{
   public static final String OBJECT_NAME_PROP = "hibernate.treecache.objectName";
   public static final String DEFAULT_OBJECT_NAME = "jboss.cache:service=HibernateTreeCache";

   private TreeCache deployedTreeCache;

   public void start(Properties properties) throws CacheException
   {
      // Determine the TreeCache MBean ObjectName.
      String configObjectName = properties.getProperty( OBJECT_NAME_PROP, DEFAULT_OBJECT_NAME );
      ObjectName objectName;
      try
      {
         objectName = new ObjectName( configObjectName );
      }
      catch( Throwable t )
      {
         throw new CacheException( "Malformed TreeCache ObjectName");
      }

      TreeCacheMBean mbean;
      try
      {
         MBeanServer server = MBeanServerLocator.locateJBoss();
         mbean = (TreeCacheMBean) MBeanProxy.get(TreeCacheMBean.class, objectName, server);
      }
      catch( Throwable t )
      {
         throw new CacheException( "Unable to locate TreeCache MBean under object name [" + configObjectName + "]" );
      }

      deployedTreeCache = mbean.getInstance();
   }

   public void stop()
   {
      deployedTreeCache = null;
   }

   public boolean isMinimalPutsEnabledByDefault()
   {
      return true;
   }

   /**
    * Called by Hibernate in order to build the given named cache "region".
    *
    * @param name The cache "region" name.
    * @param properties The configuration properties.
    * @return The constructed Cache wrapper around the jndi-deployed TreeCache.
    * @throws CacheException Generally indicates a problem locating the TreeCache.
    */
   public Cache buildCache(String name, Properties properties) throws CacheException
   {
      return new org.hibernate.cache.TreeCache( deployedTreeCache, name, TxManager.getInstance() );
   }

   public long nextTimestamp()
   {
      return System.currentTimeMillis() / 100;
   }
}


Rgds, Ales

_________________
--------------------------------
Ales Justin
JBoss, a division of Red Hat


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 5:48 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Ok, you should fix packages from H3 to H2.


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