Question 1 : my scenario is, i have to implement the oracle coherence replicated cache in my webapplication.(with weblogic server).the coherence should be the part of the weblogic server means when i start the weblogic server the coherence should start
(both should run in the single JVM).please help me how to do it ?

Question 2 : whether i need a database to maintain the records or oracle coherence it self maintain in file system ? if yes means how and what will happen for the cached data when i shutdown the server?

2 Answers
2

Place coherence.jar in the classpath. Depending on specific case it can be WLS classpath or application's classpath. Unless you want to share coherence node between many applications it is often a better idea to put it to application's classpath. It also has other advantages like easier maintenance.

Prepare your own cache configuration for the replicated topology. You can skip this step if you want to use coherence default cache configuration coherence-cache-config.xml which includes replicated topology, but keep in mind that your cache name must start with repl- and this is in general not recommended for production. Otherwise put the following to your custom-cache-config.xml file and add it to your application's classpath.

Create a ContextListener for your application and place the following code into contextInitialized method:

// join existing cluster or form a new one
CacheFactory.ensureCluster();

Start your WLS with the following option:

-Dtangosol.coherence.cacheconfig=custom-cache-config.xml

Deploy and start your application (possibly on many servers)

Q2:

In general coherence is in memory solution and doesn't persist data by default. If you need to manage data in persistent store you can look into CacheStore interface. This is described here in the documentation.

Keep in mind that often you have more than one coherence node in the cluster so you will not lose your data when you shutdown one of them because data is always stored also in other JVM(s). When you restart your node it will join the cluster and your data will be there.

Normally in your WLS application you can use Coherence like in any standalone Java application (additionally inside container you can use some specific features like Coherence*Web). The comprehensive source of truth is here and here. I would suggest to start with GSG and some tutorials. Coherence GSG, Tutorial
–
MihauNov 30 '11 at 8:28