If I understand correctly I should be able to use jboss-cache with a standard Tomcat 5.0.x servlet container (i.e. not the JBoss app server). I need to do this so that I may run two separate Tomcat machines as a cluster for improved availability.
Things work great with ehcache, but when I switch the configuration to jboss-cache 1.1.1 (the one included with Hibernate 2.1.7) I am having the problems.
It does not appear to find my Eviction Policy config - though it is clearly there. I have re-read the Hibernate in Action section several times, run the jboss-cache demos, etc. Still do not seem my problem.
Thanks for any ideas at all - Richard
Hibernate version:
2.1.7
Mapping documents:
First the hibernate.cfg.xml, then treecache.xml
hibernate.cfg.xml BEGIN:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction/
</property>
<!-- properties for this SessionFactory only -->
<!-- property name="connection.datasource">java:comp/env/jdbc/@WEBAPPNAME@</property -->
<property name="dialect">
[email protected]@SQLDialect</property>
<property name="hibernate.cache.provider_class">net.sf.hibernate.cache.TreeCacheProvider</property>
<property name="cache.provider_class">net.sf.hibernate.cache.TreeCacheProvider</property>
<!-- mapping files -->
<mapping resource="com/ltoj/persistence/base/PoAddress.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAddressType.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAggregation.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAggrMeasurement.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAssessment.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAssociate.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAssocPref.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoAssocPolicy.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoChar.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoCharChoice.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoCharValue.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoClass.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoClassMeasurement.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoCountry.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoEnrollment.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoEthnicity.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoGradeLevel.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoIndDisabEducAct.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoLanguage.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoMeasurementParms.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoMeasurementUnit.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoOrganizationType.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoOrgPolicy.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoPhoneNumber.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoPhoneNumberType.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoResult.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoRole.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoStateProvince.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoStatus.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoSubject.hbm.xml"/>
<mapping resource="com/ltoj/persistence/base/PoUserRole.hbm.xml"/>
<class-cache class="com.ltoj.persistence.base.PoAssessment" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoAssocPolicy" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoChar" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoCharChoice" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoCharValue" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoClass" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoClassMeasurement" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoEthnicity" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoGradeLevel" usage="read-only"/>
<class-cache class="com.ltoj.persistence.base.PoIndDisabEducAct" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoLanguage" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoMeasurementParms" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoMeasurementUnit" usage="transactional"/>
<!-- class-cache class="com.ltoj.persistence.base.PoOrganization" usage="transactional"/ -->
<class-cache class="com.ltoj.persistence.base.PoOrganizationType" usage="read-only"/>
<class-cache class="com.ltoj.persistence.base.PoOrgPolicy" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoResult" usage="transactional"/>
<class-cache class="com.ltoj.persistence.base.PoRole" usage="read-only"/>
<class-cache class="com.ltoj.persistence.base.PoStatus" usage="read-only"/>
<!-- class-cache class="com.ltoj.persistence.base.PoStudent" usage="transactional"/ -->
<class-cache class="com.ltoj.persistence.base.PoSubject" usage="transactional"/>
<!-- class-cache class="com.ltoj.persistence.base.PoUser" usage="transactional"/ -->
</session-factory>
</hibernate-configuration>
hibernate.cfg.xml END:
treecache.xml BEGIN:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
<mbean code="org.jboss.cache.TreeCache"
name="jboss.cache:service=TreeCache">
<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
<attribute name="TransactionManagerLookupClass">org.jboss.cache.DummyTransactionManagerLookup</attribute>
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<attribute name="CacheMode">LOCAL</attribute>
<attribute name="ClusterName">TreeCache-Cluster</attribute>
<attribute name="ClusterConfig">
<config>
<UDP mcast_addr="192.168.1.130" mcast_port="45566"
ip_ttl="64" ip_mcast="true"
mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
loopback="true"/>
<PING timeout="2000" num_initial_members="3"
up_thread="false" down_thread="false"/>
<MERGE2 min_interval="10000" max_interval="20000"/>
<FD shun="true" up_thread="true" down_thread="true"/>
<VERIFY_SUSPECT timeout="1500"
up_thread="false" down_thread="false"/>
<pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
up_thread="false" down_thread="false"/>
<pbcast.STABLE desired_avg_gossip="20000"
up_thread="false" down_thread="false"/>
<UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
down_thread="false"/>
<FRAG frag_size="8192"
down_thread="false" up_thread="false"/>
<pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
shun="true" print_local_addr="true"/>
<pbcast.STATE_TRANSFER up_thread="false" down_thread="false"/>
</config>
</attribute>
<attribute name="MaxCapacity">20000</attribute>
<attribute name="InitialStateRetrievalTimeout">20000</attribute>
<attribute name="SyncReplTimeout">10000</attribute>
<attribute name="LockAcquisitionTimeout">15000</attribute>
<attribute name="LockLeaseTimeout">60000</attribute>
<attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
<attribute name="EvictionPolicyConfig">
<config>
<attribute name="wakeUpIntervalInSeconds">5</attribute>
<region name="/_default_">
<attribute name="maxNodes">5000</attribute>
<attribute name="timeToIdleSeconds">1000</attribute>
</region>
<region name="com.ltoj.persistence.base.PoOrganization">
<attribute named="maxNodes">50</attribute>
<attribute named="timeToIdleSeconds">7200</attribute>
</region>
</config>
</attribute>
</mbean>
</server>
treecache.xml END:
Code between sessionFactory.openSession() and session.close():
Do not think this is applicable.
Full stack trace of any exception that occurs:
Here is the initial exception and logs messages (let me know if you need more - there are other cascading exceptions as the cache attempts to instantiate):
Dec 7, 2004 2:12:44 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.TreeCacheProvider
Dec 7, 2004 2:12:44 PM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
14:12:44,546 INFO [http8080-Processor25] PropertyConfigurator:172 - configure(): attribute size: 17
14:12:44,578 DEBUG [http8080-Processor25] PropertyConfigurator:208 - setting attribute TransactionManagerLookupClass to org.jboss.cache.DummyTransactionManagerLookup
14:12:44,578 DEBUG [http8080-Processor25] PropertyConfigurator:208 - setting attribute IsolationLevel to REPEATABLE_READ
14:12:44,578 DEBUG [http8080-Processor25] PropertyConfigurator:208 - setting attribute CacheMode to LOCAL
14:12:44,578 DEBUG [http8080-Processor25] PropertyConfigurator:208 - setting attribute ClusterName to TreeCache-Cluster
14:12:44,578 DEBUG [http8080-Processor25] PropertyConfigurator:250 - Invoking setter method: public void org.jboss.cache.TreeCache.setClusterConfig(org.w3c.dom.Element) with parameter "[config: null]" of type class org.apache.xerces.dom.DeferredElementImpl
14:12:44,578 INFO [http8080-Processor25] TreeCache:621 - setClusterConfig(): setting cluster properties from xml to: UDP(ip_mcast=true;ip_ttl=64;loopback=true;mcast_addr=192.168.1.130;mcast_port=45566;mcast_recv_buf_size=80000;mcast_send_buf_size=150000;ucast_recv_buf_size=80000;ucast_send_buf_size=150000):PING(down_thread=false;num_initial_members=3;timeout=2000;up_thread=false):MERGE2(max_interval=20000;min_interval=10000):FD(down_thread=true;shun=true;up_thread=true):VERIFY_SUSPECT(down_thread=false;timeout=1500;up_thread=false):pbcast.NAKACK(down_thread=false;gc_lag=50;retransmit_timeout=600,1200,2400,4800;up_thread=false):pbcast.STABLE(desired_avg_gossip=20000;down_thread=false;up_thread=false):UNICAST(down_thread=false;min_threshold=10;timeout=600,1200,2400;window_size=100):FRAG(down_thread=false;frag_size=8192;up_thread=false):pbcast.GMS(join_retry_timeout=2000;join_timeout=5000;print_local_addr=true;shun=true):pbcast.STATE_TRANSFER(down_thread=false;up_thread=false)
14:12:44,578 DEBUG [http8080-Processor25] PropertyConfigurator:250 - Invoking setter method: public void org.jboss.cache.TreeCache.setInitialStateRetrievalTimeout(long) with parameter "20000" of type class java.lang.Long
14:12:44,593 DEBUG [http8080-Processor25] PropertyConfigurator:250 - Invoking setter method: public void org.jboss.cache.TreeCache.setSyncReplTimeout(long) with parameter "10000" of type class java.lang.Long
14:12:44,593 DEBUG [http8080-Processor25] PropertyConfigurator:250 - Invoking setter method: public void org.jboss.cache.TreeCache.setLockAcquisitionTimeout(long) with parameter "15000" of type class java.lang.Long
14:12:44,593 DEBUG [http8080-Processor25] PropertyConfigurator:208 - setting attribute EvictionPolicyClass to org.jboss.cache.eviction.LRUPolicy
14:12:44,609 DEBUG [http8080-Processor25] PropertyConfigurator:250 - Invoking setter method: public void org.jboss.cache.TreeCache.setEvictionPolicyConfig(org.w3c.dom.Element) with parameter "[config: null]" of type class org.apache.xerces.dom.DeferredElementImpl
14:12:44,609 INFO [http8080-Processor25] TreeCache:573 - setEvictionPolicyConfig(): [config: null]
Dec 7, 2004 2:12:44 PM net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
14:12:44,625 DEBUG [http8080-Processor25] TreeCache:266 - Starting TreeCache
14:12:44,640 ERROR [http8080-Processor25] DummyTransactionManager:45 - binding of DummyTransactionManager failed
javax.naming.NamingException: Context is read only
at org.apache.naming.NamingContext.checkWritable(NamingContext.java:948)
at org.apache.naming.NamingContext.bind(NamingContext.java:876)
at org.apache.naming.NamingContext.bind(NamingContext.java:216)
at org.apache.naming.NamingContext.bind(NamingContext.java:232)
at org.apache.naming.SelectorContext.bind(SelectorContext.java:217)
at javax.naming.InitialContext.bind(InitialContext.java:355)
at org.jboss.cache.transaction.DummyTransactionManager.getInstance(DummyTransactionManager.java:41)
at org.jboss.cache.DummyTransactionManagerLookup.getTransactionManager(DummyTransactionManagerLookup.java:17)
at org.jboss.cache.TreeCache.startService(TreeCache.java:1098)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:172)
at net.sf.hibernate.cache.TreeCache.<init>(TreeCache.java:47)
at net.sf.hibernate.cache.TreeCacheProvider.buildCache(TreeCacheProvider.java:14)
at net.sf.hibernate.cfg.Configuration.configureCaches(Configuration.java:1135)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:795)
at com.ltoj.persistence.ServiceLocator.<init>(ServiceLocator.java:86)
at com.ltoj.persistence.ServiceLocator.<clinit>(ServiceLocator.java:62)
at com.ltoj.webapp.filter.ActionFilter.doFilter(ActionFilter.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
Name and version of the database you are using:
MySQL 4.1.7
The generated SQL (show_sql=true):
Do not think applicable
Debug level Hibernate log excerpt:
Available if needed.