Problems deploying Cache via MicroContainer following UserGu
angusm Mar 20, 2009 8:06 AMI hit one or two little problems following the UserGuide to deploy the Cache. So for the benefit of anyone who follows ....
I am using JBC 3.0.3 with JBossAS 5.0.1. (I copied the jbosscache-core.jar from the release to the server/all/lib directory.)
First, contrary to what is stated in the UserGuide, the name of deployment file must end with "-jboss-beans.xml", not "-beans.xml".
The annotation entry for CacheJmsWrapper must be all on one line.
After that I hit a 'UnsupportedOperationException: Not supported in UnversionedNode' which looked suspiciously like https://jira.jboss.org/jira/browse/JBCACHE-1478. But this is reported as corrected in 3.0.3. I got round it by setting the DefaultCacheFactory boolean parameter to true.
My final "example-jboss-beans.xml" file is below.
<?xml version="1.0" encoding="UTF-8"?> <deployment xmlns="urn:jboss:bean-deployer:2.0"> <!-- First we create a Configuration object for the cache --> <bean name="ExampleCacheConfig" class="org.jboss.cache.config.Configuration"> <!-- Externally injected services --> <property name="runtimeConfig"> <bean class="org.jboss.cache.config.RuntimeConfig"> <property name="transactionManager"> <inject bean="jboss:service=TransactionManager" property="TransactionManager"/> </property> <property name="muxChannelFactory"><inject bean="JChannelFactory"/></property> </bean> </property> <property name="multiplexerStack">udp</property> <property name="clusterName">Example-EntityCache</property> <property name="isolationLevel">REPEATABLE_READ</property> <property name="cacheMode">REPL_SYNC</property> <property name="stateRetrievalTimeout">15000</property> <property name="syncReplTimeout">20000</property> <property name="lockAcquisitionTimeout">15000</property> <property name="exposeManagementStatistics">true</property> </bean> <!-- Factory to build the Cache. --> <bean name="DefaultCacheFactory" class="org.jboss.cache.DefaultCacheFactory"> <constructor factoryClass="org.jboss.cache.DefaultCacheFactory" factoryMethod="getInstance" /> </bean> <!-- The cache itself --> <bean name="ExampleCache" class="org.jboss.cache.Cache"> <constructor factoryMethod="createCache"> <factory bean="DefaultCacheFactory"/> <parameter class="org.jboss.cache.config.Configuration"><inject bean="ExampleCacheConfig"/></parameter> <parameter class="boolean">true</parameter> </constructor> </bean> <!-- JMX Management --> <bean name="ExampleCacheJmxWrapper" class="org.jboss.cache.jmx.CacheJmxWrapper"> <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.cache:service=ExampleTreeCache", exposedInterface=org.jboss.cache.jmx.CacheJmxWrapperMBean.class, registerDirectly=true)</annotation> <constructor> <parameter><inject bean="ExampleCache"/></parameter> </constructor> </bean> </deployment>[/url]