Version 4

    Since JBoss Cache 3 is nearly ready to go GA, we are beginning an effort to see if it can be used in JBoss AS 5.0.0.GA. This involves creating a dev branch of the AS and EJB3 and using them to test 3.x versions of JBC and PojoCache, making code modifications as needed.


    This page documents how to use the AS and EJB3 testsuites to do this testing. See also AS Clustering Testsuite for background information on the testsuite.


    Using the Testsuite


    I set up the following directory structure; you can of course do whatever you like; I show this to make the rest easier to understand:


    ++ bes
    ++++ JBC3_in_AS5
    ++++++ AS
    ++++++ EJB3


    To check out the AS branch:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS
    [bes@besdev AS]$ svn checkout


    To check out the EJB3 branch:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/EJB3
    [bes@besdev AS]$ svn checkout


    To build the AS:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/build
    [bes@besdev AS]$ ./


    To build the AS testsuite:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ ./


    To build the EJB3 testsuite:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/EJB3/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ mvn install


    At this point the hope is there will be no reason to modify any EJB3 code; I just created Branch_JBoss_Cache_3 in EJB3 so we have a stable copy of the EJB3 testsuite to work with. If there is a need to build any other part of EJB3 besides the testsuite module, go to the root of the ejb3 checkout and "mvn install".  The code relevant to JBC is in the "core" module found at the same level as "testsuite".  There is also a "proxy-clustered" module at the same level that is relevant to clustering, but not related to EJB3's use of JBC.


    To run the core part of the AS clustering testsuite:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ ./ tests-clustering


    That tests using the default UDP-based JGroups stacks. To run with both UDP and TCP (normally only necessary for final checks):


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ ./ tests-clustering-all-stacks


    ClusteredSingleSignOn is tested via a different target:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ ./ tomcat-sso-clustered-tests


    There is also a separate target for testing for classloader leaks due to clustering:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ ./ tests-clustered-classloader-leak


    As of 2008/10/23, on trunk there are intermittently one or two failures of the FieldGranularityClassLoaderLeakUnitTestCase, so don't regard that as a regression. All other tests pass, although there are infrequent intermittent failures in others.


    The tests in the org.jboss.test.cluster.defaultcfg.simpleweb.test package mostly relate to JBC and can be run from inside an IDE.  The others need to be run from the command line.


    To generate test reports and view in Firefox:


    [bes@besdev ~]$ cd /home/bes/dev/JBC3_in_AS5/AS/Branch_JBoss_Cache_3/testsuite
    [bes@besdev AS]$ ./ tests-report-html
    [bes@besdev AS]$ firefox output/reports/html/index.html


    The EJB3 clustering testsuite is executed via Ant. Before executing, you need to set an environment variable telling the testsuite where to find your install of JBoss AS:


    [bes@besdev testsuite]$ export JBOSS_HOME=/home/bes/dev/Branch_JBoss_Cache_3/AS/Branch_JBoss_Cache_3/build/output/jboss-5.0.0.GA/
    [bes@besdev testsuite]$ ant -f build-test.xml clustered-tests


    As of 2008/10/23, the NestedBeanUnitTestCase.testStatefulPassivation test intermittently fails.  The test is executed twice, once with buddy replication, once without, so you may see two failures. Any failure in a different test class or method or from a different assertion than the following should be regarded as a regression:


    Remote nested passivate count:  expected:<3> but was:<8>
    junit.framework.AssertionFailedError: Remote nested passivate count:  expected:<3> but was:<8>
         at org.jboss.ejb3.test.stateful.unit.NestedBeanTestRunner.testStatefulPassivation(
         at org.jboss.ejb3.test.clusteredsession.unit.NestedBeanUnitTestCase.testStatefulPassivation(
         at junit.extensions.TestDecorator.basicRun(
         at junit.extensions.TestSetup$1.protect(


    Building the EJB3 testsuite reports is also via Ant, although the report output is in the standard Maven location:


    [bes@besdev testsuite]$ ant -f build-test.xml tests-report-html
    [bes@besdev testsuite]$ firefox target/reports/html/index.html


    Changing JBoss Cache / Pojo Cache Versions


    As new CR2s, betas etc of JBoss Cache are PojoCache are published, you tell the AS to use them by editing the pom.xml file in the AS's component-matrix module.




    Initial Results


    I ran the AS tests and the EJB3 tests and found the following:


    1) The AS tests involving JBC and outside the org.jboss.test.cluster.defaultcfg.simpleweb.test package look good.

    2) The EJB3 entity caching tests (in the org.jboss.ejb3.test.clusteredentity package) look good.

    3) The tests in the org.jboss.test.cluster.defaultcfg.simpleweb.test package as well as the FIELD granularity (i.e. PojoCache) tests fail. Cause in all cases is likely this:



    java.lang.NoSuchMethodError: org.jboss.cache.DefaultCacheFactory.getInstance()Lorg/jboss/cache/DefaultCacheFactory;
         at org.jboss.cache.pojo.impl.PojoCacheImpl.&lt;init&gt;(
         at org.jboss.cache.pojo.PojoCacheFactory.createCache(
         at org.jboss.test.cluster.testutil.SessionTestUtil.getConfiguration(
         at org.jboss.test.cluster.testutil.SessionTestUtil.createCache(
         at org.jboss.test.cluster.testutil.CacheConfigTestSetup.setUp(
         at junit.extensions.TestSetup$1.protect(


    I think this is just a matter of Jason recompiling PojoCache against JBC core 3.0.0.CR2 (which has changed the return type of the above method to "CacheFactory") and then uploading a new snapshot.


    4) The EJB3 SFSB clustering tests fail. A quick look at failure reports show this:


    Caused by: java.lang.NullPointerException
         at org.jboss.cache.RegionImpl.registerEvictionEvent(
         at org.jboss.cache.RegionImpl.unmarkNodeCurrentlyInUse(
         at org.jboss.ejb3.cache.tree.StatefulTreeCache.release(
         at org.jboss.ejb3.cache.tree.StatefulTreeCache.release(
         at org.jboss.ejb3.stateful.StatefulContainer.createSession(
         at org.jboss.ejb3.session.SessionContainer.createSession(
         at org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionProxyFactoryBase.getNewSessionId(
         at org.jboss.ejb3.proxy.factory.session.stateful.StatefulSessionProxyFactoryBase.createProxyBusiness(
         at org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory.createProxy(
         at org.jboss.ejb3.proxy.clustered.objectfactory.session.stateful.StatefulSessionClusteredProxyObjectFactory.getProxy(
         at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(
         at javax.naming.spi.NamingManager.getObjectInstance(
         at org.jnp.interfaces.NamingContext.getObjectInstance(
         at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(


    The RegionImpl.evictionAlgorithm field is null.  StatefulTreeCache programatically creates eviction regions; likely the JBC 3 changes to the way eviction is handled are breaking with this usage.