Apr
03
Adding Cache support to a Seam project (Seam 2.1.x) it’s very simple and it is described in the official Seam developer documentation, anyways it doesn’t explain the exact steps to accomplish the task into an EAR project, I’m writing them to make your life even more simple
- Add treecache.xml (you can find it into the seam blog example) to /resources/META-INF/
- Open build.xml for editing, go to the “ear” target and tell to copy the treecache.xml file:
<target name=”ear” description=”Build the EAR structure in a staging directory”>
…
<copy todir=”${ear.dir}/META-INF”>
<fileset dir=”${basedir}/resources/META-INF”>
<include name=”application.xml”/>
<include name=”jboss-app.xml”/>
<include name=”seam-deployment.properties”/>
<include name=”treecache.xml”/>
</fileset>
</copy>
</target> - Edit components.xml, add the following XMLNS:
xmlns:cache=”http://jboss.com/products/seam/cache”The following schema location:
http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsdAnd the following declaration:
<cache:jboss-cache-provider configuration=”META-INF/treecache.xml” /> - Edit deployed-jars-ear.list and add the required JARs, I used the JBoss Cache 1.x for JBoss AS 4.2.X:
jboss-cache.jar
jgroups.jarHere there is the list of jars (and versions) for other configurations.
And here you find the way how to use it in your projects.
Hope you liked it.
Demetrio