Setting up Oracle Weblogic Coherence
This section describes a GAR file that is deployed to Weblogic for Coherence configuration.
Completing the Prerequisite Tasks
To complete the prerequisite tasks,
- Set up the proxy for pure java clients (non application server clients) in the TAFJCache.gar file. The TAFJCache.gar file can be found in $TAFJ_HOME/appserver/weblogic.
- Change localhost to the IP address of the server.
<!-- One or more proxy schemes defined for client connections. Change address for each server.
See https://docs.oracle.com/cd/E18686_01/coh.37/e18678/gs_configextend.htm#COHCG5021 for more info
-->
<proxy-scheme>
<service-name>ExtendTcpProxyService</service-name>
<acceptor-config>
<tcp-acceptor>
<local-address>
<address>localhost</address>
<port>9099</port>
</local-address>
</tcp-acceptor>
</acceptor-config>
<proxy-config>
<cache-service-proxy>
<enabled>true</enabled>
<lock-enabled>true</lock-enabled>
</cache-service-proxy>
<invocation-service-proxy>
<enabled>true</enabled>
</invocation-service-proxy>
</proxy-config>
<autostart>true</autostart>
</proxy-scheme>
Setting up Oracle Coherence for Standalone Clients
To setup oracle coherence for standalone clients,
- Uncomment the following line in tafj_conf.bat (sh) to set up the JVM properties. This is done for the clients who run pure java client programs such as tRun with Coherence clusters inside or outside of WebLogic.
rem # If using oracle coherence
export "JAVA_OPTS=$JAVA_OPTS -Dcoherence.cacheconfig=tafj-cache-config-client.xml -Dcoherence.jcache.configuration.classname=passthrough -Dcoherence.log=log4j -Dcoherence.log.level=1"
- Set the following properties in $TAFJ_HOME/conf/cache/tafj-cache-config-client.xml and change the localhost to the IP address of the server.
<!-- remote-scheme for Coherence client connections (Weblogic Coherence must be running). Change address from localhost to IP of server.
See https://docs.oracle.com/cd/E18686_01/coh.37/e18678/gs_configextend.htm#COHCG5021 for more info
-->
<remote-cache-scheme>
<scheme-name>extend-remote</scheme-name>
<service-name>ExtendTcpProxyService</service-name>
<initiator-config>
<tcp-initiator>
<remote-addresses>
<socket-address>
<address>localhost</address>
<port>9099</port>
</socket-address>
</remote-addresses>
</tcp-initiator>
<outgoing-message-handler>
<request-timeout>5s</request-timeout>
</outgoing-message-handler>
</initiator-config>
</remote-cache-scheme>
Oracle Coherence setup for All Clients
The value in CACHENAME for the particular table matches to a defined cache setup in Oracle Coherence. For standalone mode (not in a WebLogic application server), the cache names must match with the definition that are available in $TAFJ_HOME/conf/cache/tafj-cache-config-client.xml.
In the example below, Tables is the cache name used in the CACHENAME column. This matches the definition found in tafj-cache-config.xml. These definitions must match or the cache will not be found.
<?xml version="1.0"?>
<!-- This cache configuration file is for the storage enabled and disabled
members in the Managed Coherence Server example. -->
<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd">
<defaults>
<scope-name>TAFJCache</scope-name>
</defaults>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>Tables</cache-name>
<scheme-name> extend-remote </scheme-name>
</cache-mapping>
</caching-scheme-mapping>
The <scheme-name> maps to an Oracle cache configuration within the same tafj-cache-config-client.xml file. In the above example, extend-remote refers to a caching scheme on the Coherence server. This scheme was shown earlier in Setting up Oracle Coherence for Standalone Clients inside the <remote-cache-scheme> tag.
Once the table matches within TAFJ (comparing the <cache-name> element against the CACHENAME column in the TAFJ_CACHE
table), caching on that table will begin across a cluster. Writes on cached data delete the element from the cache, and keys must be re-read. If a node in the cluster is shutdown, its elements will also be removed from the cache (if the data is not using a replicated scheme), and the data will have to be re-read by other nodes. Using replicated data does incur a performance cost especially with writing to caches, so make sure on what scheme you want to use.
You must be very careful not to exceed the memory assigned and must setup the appropriate expiry times for data to be refreshed. Also, when data is being written within Temenos Transact for a particular record, the record is cached and the cache is emptied of that key so that subsequent reads shall get fresh data.
Logging Coherence
This section shows you how to get the Coherence logs.
In standalone mode, set the following properties in $TAFJ_HOME/bin/tafj_conf.bat (sh) so that Coherence logs to the COHERENCE appender in TAFJTrace.properties.
-Dcoherence.log=log4j -Dcoherence.log.level=1
Appender in TAFJTrace.properties:
log4j.logger.Coherence=INFO, coherence
Deploying the TAFJ.gar file
You can deploy the TAFJCache.gar file as a library and reference it within the TAFJJEE_EAR.ear file, but this approach raises reloading issues. This section shows you how to avoid these reloading issues.
To avoid the reloading issues,
- Add the following configuration in the weblogic-application.xml file to deploy TAFJCache.gar in the TAFJJEE_EAR.ear file.
<module>
<name>TAFJCache</name>
<type>GAR</type>
<path>TAFJCache.gar</path>
</module>
- Configure TAFJCache.gar at the root level of the TAFJJEE_EAR.ear file.
Running Coherence in Standalone Mode
This section highlights the rules and steps that are required to run Coherence in standalone mode.

There are two rules for running Coherence in Standalone Mode:
- You should not expect to write data to the database and expect the application server to know about it if that data is cached at the application server. Hence, it is very dangerous to write data outside of an application server context where data is cached.
- When running Coherence or another provider outside of an application server, it doesn’t mean you are speaking to the cluster caches that the application server is using. Most likely, they are different.

To run the coherence,
- In order to run in standalone mode, check if at least one coherence server is running (you can have multiple if desired).
- Make COHERENCE_HOME as the install directory of Coherence. For example,
C:\ >java -Dcoherence.cacheconfig=%TAFJ_HOME%\conf\cache\tafj-cache-config.xml -cp %TAFJ_HOME%\conf\cache;%COHERENCE_HOME%\lib\coherence.jar;%COHERENCE_HOME%\lib\cache-api.jar;%COHERENCE_HOME%\lib\coherence-jcache.jar com.tangosol.net.DefaultCacheServer
The tafj-cache-config.xml file must be found in the classpath. The tangosol-coherence-override-dev.xml file in %TAFJ_HOME%\conf\cache overrides the cluster name and sets up logging to use the TAFJTrace.properties file, but you don’t have to do that. - Now uncomment the following property in tafj_conf.bat or tafj_conf.sh and run tRun or any program from %TAFJ_HOME%\bin.
set "JAVA_OPTS=%JAVA_OPTS% -Dcoherence.cacheconfig=tafj-cache-config.xml -Dcoherence.jcache.configuration.classname=passthrough"
Monitoring Coherence
See the instructional video by Oracle on how to monitor Coherence caches through jVisualVM.
In this topic