3 Replies Latest reply on Sep 20, 2012 6:43 PM by adobe30022

    How to get Oracle Coherence caching running within CQ5

    Charlie Jones Nike

      I've been trying to get Oracle Coherence running within CQ5 and I'm having problems with the setup.  First, I've been successful in creating an OSGi bundle jar from coherence.jar and it does deploy successfully through the Felix OSGi console.  But when I try to execute code using the Coherence classes, I get RMI marshalling run-time errors.  I've resolved the other run-time errors that have to do with the Import-Package definition in manifest.mf for the bundle.  I believe that the root problem that I'm facing is the deployment of the files tangosol-coherence-override.xml and the additional xml file that it points to.  I don't believe that these two files are being found within CQ5 correctly.  I've tried placing these files in the following locations:

      1.  Within coherence.jar itself (at the root directory)

      2.  In the CQ5 application's install folder

      3.  In the CQ5 application's src/main/resources folder


      Has anyone ever deployed Oracle Coherence in CQ5 or can give me a suggestion on what to try?  I appreciate any help or ideas.


      Thanks!  - Charlie

        • 1. Re: How to get Oracle Coherence caching running within CQ5
          Sham HC Level 7

          There are 3 options which is described below. The steps may slightly vary based on cq & Oracle Coherence version. The details mentioned below are for cq5.4 & Coherence 3.7.1


          • Option 1:-  Oracle recommended way


          *     Create a basic Web application directory






          *     jar -cvf hello.war *


          *     Deploy the hello.war file by going to cq servlet engine at http://<host>:<port>/admin


          *     Access your sample with http://<host>:<port>/<contextroot>/Sample.jsp


          • Option 2:-  Combination of Option 1 & Option 3


          *      Stop the cq

          *      Place coherence.jar at <CQ_Install_Dir>/crx-quickstart/server/runtime/0/_/WEB-INF/lib/

          *      Place tangosol-coherence-override.xml and all additional xml files at <CQ_Install_Dir>/crx-quickstart/server/runtime/0/_/WEB-INF/classes/

          *      Modify <CQ_Install_Dir>/crx-quickstart/launchpad/sling.properties to add below properties




          *       Start the cq

          *       Verify jsp script etc... by putting into cache.. Same thing like


                      String key = "k2";

                      String value = "Hello World from cq!";

          ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();

          ClassLoader newLoader = com.tangosol.net.CacheFactory.class.getClassLoader();




                      NamedCache cache = CacheFactory.getCache("hello-example");


                      cache.put(key, value);









          • Option 3 :-   The one you are trying by creating an OSGi bundle jar from coherence.jar & prefeerd approach also. I haven't tried this approach but just throughing some thaughts.


          *    From some of oracle seminors I remembered oracle had a plans to have OSGi jar for Coherence. Try to get that instead of building the one ourself.


          *    If it is not available then Looking at your problem as a workaround i can think of is try with putting the XML file in the repository  & load xml in java class something like as



          • 2. Re: How to get Oracle Coherence caching running within CQ5
            Charlie Jones Nike Level 1

            Thanks Sham for taking the time to put together three options!  I tried all three and had the best successful with Option 2.  My guess is that registering Coherence with Sling was important.  I do occassionally get a "can't start up DistributedCache service" exception which is requiring me to restart CQ5 but hopefully we'll figure out what's causing this by playing around some more.


            I am having to make changes to the manifest in the coherence.jar that was manually created to be an OSGi bundle.  I really hope that Oracle will spend the time to create an official OSGi compliant jar because this will probably be a lot more stable than what we're creating with our manual efforts.


            I'll keep updating this thread with our findings so that it can hopefully help others who are interested in running Coherence in CQ5.




            • 3. Re: How to get Oracle Coherence caching running within CQ5

              I am new to CQ5.5 so please pardon my ignorance. What exactly does "My guess is that registering Coherence with Sling was important" mean?  Can someone please explain how to register Coherence with Sling in CQ5.5


              Thank you!!!