1 Installing Coherence and JDeveloper

This chapter describes how to install and set up your environment for running Oracle JDeveloper Studio Edition 11g and Oracle Coherence Release 3.6. This chapter contains the following sections:

This chapter assumes that you have the privileges to install software and set system environment variables as the oracle user, an understanding of how to use a terminal window, including setting environment variables, and creating and moving between directories. It also assumes that you have a working installation of Java SE (JDK) version 1.6 or higher.

This chapter also assumes that you are running one of the following Microsoft Windows operating systems: XP, Vista, 2000, 2003, or 2008.

1.1 Downloading and Installing Coherence

To download and install Oracle Coherence:

  1. Download Oracle Coherence to your desktop.

    Coherence (Java edition) ships as a single zip file, typically called coherence-<version>.zip. You can obtain Coherence from the following URL:

    http://www.oracle.com/technology/products/coherence/index.html

  2. Extract the contents of the zip file to a directory named C:\oracle\product.

    The zip file contains the coherence directory with these subdirectories:

    • bin, which contains command scripts

    • doc, which contains the product documentation

    • lib, which contains the required library files

1.2 Downloading and Installing JDeveloper

To download and install Oracle JDeveloper Studio Edition 11g:

  1. Download Oracle JDeveloper Studio.

    You can obtain JDeveloper Studio 11g from the following URL:

    http://www.oracle.com/technology/products/jdev/index.html

  2. Run the JDeveloper Studio installer.

    If you are asked for a User Role when JDeveloper starts, select Default Role to enable all technologies.

    Follow the prompts in the installation screens. If the installer asks for a Middleware Home, enter C:\oracle\product if it does not exist.

1.3 Testing a Coherence Installation

In this exercise, you test whether your Coherence installation can cluster Java processes. This ensures that Coherence-based applications that ship with Coherence will run as expected. If Coherence is not capable of clustering on a single machine, then you must reconfigure your network and firewall settings.

This exercise assumes that you have installed Oracle Coherence (Java Edition) Release 3.6 (See "Downloading and Installing Coherence").

Coherence uses a variety of network addresses and ports to enable communication between clustered processes. If these addresses and/or ports are unavailable due to other applications using them, or because of a firewall, then Coherence may be unreliable, may fail to cluster, or may not work at all. By default, Coherence assumes that the network addresses and ports listed in Table 1-1 are available:

Table 1-1 Network Addresses and Ports Used by Coherence

Address / Port / Type Purpose

224.version / version / Multicast

Cluster member discovery and broadcast. The variable version represents the release version of Coherence. For example, the multicast address for the 3.6.0.0 release would be 224.3.6.0. The port number also reflects the release version. For example, for the 3.6.0.0 release, the port number would be 36000. Designing the address in this way ensures that different versions of Coherence do not inadvertently cluster with each other by default.

localhost / 8088+ / Unicast

Inter-process communication between cluster members. (localhost is the local IP address and not the loop back address.)


Coherence ships with two simple command-line (shell-based) applications that can be used to determine whether Coherence operates correctly.

  • The "cache server," is a simple application that hosts and manages data on behalf of other applications in a cluster.

  • The "cache client," is a simple application that enables a developer to access, process, and update cached data within a cluster. It also provides information about the cluster. By executing these applications on either a single host or several hosts, you can determine whether Coherence is operating correctly locally or across a network.

    When an application uses Coherence out-of-the-box, objects placed into Coherence caches are typically stored and managed in-process within the application. However, to increase the availability of the objects, Coherence may manage objects in-memory but out of the application process. This allows objects to survive possible application outages (either deliberate or accidental). To manage objects in this way, Coherence uses "cache servers". The purpose of a Coherence cache server is to manage application state in a cluster outside the application process. It is much like a database server, but without the requirement for storage.

  1. Configure and Run the Sample Cache Server Application

  2. Configure and Run the Sample Cache Client Application

  3. Exercise the Sample Cache Client Application

  4. Troubleshooting Cache Server Clustering

1.3.1 Configure and Run the Sample Cache Server Application

Follow these steps to set up and run the sample cache server application.

  1. Open a terminal window and verify that the PATH environment variable is set to include the Java JDK (for example, \oracle\product\jdk160_14_R27.6.5-32\bin). If the PATH environment variable does not include the JDK \bin directory, then set it as follows:

    1. Set the JAVA_HOME environment variable to the base of the JDK installation.

      set JAVA_HOME=\oracle\product\jdk160_14_R27.6.5-32
      
    2. Include JAVA_HOME\bin in the PATH environment variable.

      set PATH=%JAVA_HOME%\bin;%PATH%
      
  2. Navigate to the directory where Coherence is installed. Edit cache-server.cmd and set the COHERENCE_HOME variable to point to the Coherence installation directory.

    cd C:\oracle\product\coherence\bin
    

    In cache-server.cmd, set the COHERENCE_HOME environment variable:

    COHERENCE_HOME=C:\oracle\product\coherence
    

    Example 1-1 illustrates cache-server.cmd with the edited value of COHERENCE_HOME.

    Example 1-1 cache-server.cmd File with an Edited COHERENCE_HOME

    @echo off
    @
    @rem This will start a cache server
    @
    setlocal
    
    :config
    @rem specify the Coherence installation directory
    set coherence_home=c:\oracle\product\coherence
    
    @rem specify the JVM heap size
    set memory=512m
    
    :start
    if not exist "%coherence_home%\lib\coherence.jar" goto instructions
    
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    
    :launch
    
    set java_opts="-Xms%memory% -Xmx%memory%"
    
    "%java_exec%" -server -showversion "%java_opts%" -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.DefaultCacheServer %1
    
    goto exit
    
    :instructions
    
    echo Usage:
    echo   ^<coherence_home^>\bin\cache-server.cmd
    goto exit
    
    :exit
    endlocal
    @echo on
    
  3. Execute the cache server application that is located in the coherence\bin directory.

    C:\oracle\product\coherence\bin>cache-server.cmd
    

    When you start the first cache server, there is a slight delay because the cache server looks for an existing cluster. When it determines that there are no clusters to join, it starts one. On start-up, the cache server produces output similar to the text in Example 1-2.

    Several important features are highlighted in the example:

    • the Java JDK version number

    • information about how configuration files are loaded. The default is to load from JAR: Loaded operational configuration from resource "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence.xml"

    • the Coherence release number: Oracle Coherence 3.6.0.0...

    • the Coherence edition: Grid Edition: Development mode

    • the multicast address. This address changes with each Coherence version. Note the 3.6.0 in the address for Coherence Release 3.6: Group{Address=224.3.6.0, Port=36000, TTL=4}

    • the Member Id indicates the number of members in your cluster. For the purposes of this exercise, the value should be 1. ThisMember=Member(Id=1...

    Example 1-2 Output from Starting a Coherence Cache Server

    C:\oracle\product\coherence\bin>cache-server.cmd
    java version "1.6.0_14"
    Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
    Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
     
    2010-05-26 14:00:10.531/0.891 Oracle Coherence 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence.xml"
    2010-05-26 14:00:10.546/0.906 Oracle Coherence 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
    2010-05-26 14:00:10.546/0.906 Oracle Coherence 3.6.0.0 DPR3 <D5> (thread=main, member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
    2010-05-26 14:00:10.562/0.922 Oracle Coherence 3.6.0.0 DPR3 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
     
    Oracle Coherence Version 3.6.0.0 DPR3 Build 16141
     Grid Edition: Development mode
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
    2010-05-26 14:00:11.109/1.469 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Loaded cache configuration from "jar:file:/C:/oracle/
    product/coherence/lib/coherence.jar!/coherence-cache-config.xml"
    2010-05-26 14:00:11.718/2.078 Oracle Coherence GE 3.6.0.0 DPR3 <D4> (thread=main, member=n/a): SystemSocketProvider bound to port 8088
    2010-05-26 14:00:15.312/5.672 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0xC4DB" with Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588,
     Role=CoherenceServer, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) UID=0x822363D500000128D66A5256C2D51F98
    2010-05-26 14:00:15.328/5.688 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Started cluster Name=cluster:0xC4DB
     
    Group{Address=224.3.6.0, Port=36000, TTL=4}
     
    MasterMemberSet
      (
      ThisMember=Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588, Role=CoherenceServer)
      OldestMember=Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588, Role=CoherenceServer)
      ActualMemberSet=MemberSet(Size=1, BitSetCount=2
        Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588, Role=CoherenceServer)
        )
      RecycleMillis=1200000
      RecycleSet=MemberSet(Size=0, BitSetCount=0
        )
      )
     
    TcpRing{Connections=[]}
    IpMonitor{AddressListSize=0}
     
    2010-05-26 14:00:15.437/5.797 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1
    2010-05-26 14:00:15.781/6.141 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1
    2010-05-26 14:00:15.859/6.219 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=ReplicatedCache, member=1): Service ReplicatedCache joined the cluster with senior service member 1
    2010-05-26 14:00:15.859/6.219 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=OptimisticCache, member=1): Service OptimisticCache joined the cluster with senior service member 1
    2010-05-26 14:00:15.859/6.219 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Invocation:InvocationService, member=1): Service InvocationService joined the cluster with senior service member 1
    2010-05-26 14:00:15.859/6.235 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=main, member=1):
    Services
      (
      ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.6, OldestMemberId=1}
      InvocationService{Name=Management, State=(SERVICE_STARTED), Id=1, Version=3.1, OldestMemberId=1}
      PartitionedCache{Name=DistributedCache, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}
      ReplicatedCache{Name=ReplicatedCache, State=(SERVICE_STARTED), Id=3, Version=3.0, OldestMemberId=1}
      Optimistic{Name=OptimisticCache, State=(SERVICE_STARTED), Id=4, Version=3.0, OldestMemberId=1}
      InvocationService{Name=InvocationService, State=(SERVICE_STARTED), Id=5, Version=3.1, OldestMemberId=1}
      )
     
    Started DefaultCacheServer...
    

    Note:

    By default, Coherence is configured to use multicast to attempt to join a cluster and to distribute cluster events. Multicast can also be used to distribute a message efficiently to multiple nodes in the cluster. Coherence can be configured so that it does not use multicast.

    The output of cache-server.cmd indicates whether you have one or more members in your cluster. The value of Member Id should be equal to 1:

    ...
    In MasterMemberSet
    ThisMember=Member(Id should be equal to 1)
    ...
    

    If Member Id is greater than 1, then multiple clusters are being formed in your subnet. For the purposes of these exercises, there should only be one member in the cluster. Follow the steps in "Restricting Coherence to Your Own Host" to restrict Coherence to your own host.

1.3.2 Configure and Run the Sample Cache Client Application

Follow these steps to set-up and run the sample cache client application.

  1. Open another terminal window to start the cache client.

    Verify that the PATH environment variable is set to include %JAVA_HOME%\bin. If the PATH environment variable does not include %JAVA_HOME%\bin, then set the variable as described in Step 1.

  2. Navigate to the \oracle\product\coherence\bin directory. Edit coherence.cmd and set the COHERENCE_HOME variable to point to the Coherence installation directory.

    Example 1-3 illustrates the coherence.cmd file, with COHERENCE_HOME=\oracle\product\coherence.

    Example 1-3 coherence.cmd File with an Edited COHERENCE_HOME

    @echo off
    @
    @rem This will start a console application
    @rem demonstrating the functionality of the Coherence(tm) API
    @
    setlocal
    
    :config
    @rem specify the Coherence installation directory
    set coherence_home=c:\oracle\product\coherence   
    
    @rem specify if the console will also act as a server
    set storage_enabled=false
    
    @rem specify the JVM heap size
    set memory=64m
    
    :start
    if not exist "%coherence_home%\lib\coherence.jar" goto instructions
    
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    
    :launch
    
    if "%storage_enabled%"=="true" (echo ** Starting storage enabled console **) else (echo ** Starting storage disabled console **)
    
    set java_opts="-Xms%memory% -Xmx%memory% -Dtangosol.coherence.distributed.localstorage=%storage_enabled%"
    
    "%java_exec%" -server -showversion "%java_opts%" -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.CacheFactory %1
    
    goto exit
    
    :instructions
    
    echo Usage:
    echo   ^<coherence_home^>\bin\coherence.cmd
    goto exit
    
    :exit
    endlocal
    @echo on
    
  3. Execute the coherence.cmd file to start the cache client. This application shows you the basic distributed cache functionality that is built within Coherence.

    coherence.cmd
    

    Example 1-4 illustrates the output from starting the cache client. Note the following features of the output:

    • the client is the second member of the cluster (the server is the first member): ThisMember=Member(Id=2,...

    • at the end of the output, you should see the Map(?) prompt

    Example 1-4 Output from Starting the Coherence Cache Client

    ** Starting storage disabled console **
    java version "1.6.0_14"
    Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
    Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
     
    2010-05-26 14:15:08.187/0.344 Oracle Coherence 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence.xml"
    2010-05-26 14:15:08.203/0.360 Oracle Coherence 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/tangosol-coherence-override-dev.xml"
    2010-05-26 14:15:08.203/0.360 Oracle Coherence 3.6.0.0 DPR3 <D5> (thread=main, member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified
    2010-05-26 14:15:08.203/0.360 Oracle Coherence 3.6.0.0 DPR3 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
     
    Oracle Coherence Version 3.6.0.0 DPR3 Build 16141
     Grid Edition: Development mode
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
     
    2010-05-26 14:15:08.859/1.016 Oracle Coherence GE 3.6.0.0 DPR3 <D4> (thread=main, member=n/a): SystemSocketProvider bound to port 8090
    2010-05-26 14:15:10.125/2.282 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=Cluster, member=n/a): This Member(Id=2, Timestamp=2010-05-26 14:15:10.102, Address=130.35.99.213:8090, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:636, Role=CoherenceConsole, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) joined cluster "cluster:0xC4DB" with senior Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588, Role=CoherenceServer, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1)
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=n/a): Member 1 joined Service Cluster with senior member 1
     
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=n/a): Member 1 joined Service Management with senior member 1
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=n/a): Member 1 joined Service DistributedCache with senior member 1
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=n/a): Member 1 joined Service ReplicatedCache with senior member 1
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=n/a): Member 1 joined Service OptimisticCache with senior member 1
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=n/a): Member 1 joined Service InvocationService with senior member 1
    2010-05-26 14:15:10.187/2.344 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=main, member=n/a): Started cluster Name=cluster:0xC4DB
     
    Group{Address=224.3.6.0, Port=36000, TTL=4}
     
    MasterMemberSet
      (
      ThisMember=Member(Id=2, Timestamp=2010-05-26 14:15:10.102, Address=130.35.99.213:8090, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:636, Role=CoherenceConsole)
      OldestMember=Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588, Role=CoherenceServer)
      ActualMemberSet=MemberSet(Size=2, BitSetCount=2
        Member(Id=1, Timestamp=2010-05-26 14:00:11.734, Address=130.35.99.213:8088, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:5588, Role=CoherenceServer)
        Member(Id=2, Timestamp=2010-05-26 14:15:10.102, Address=130.35.99.213:8090, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:636, Role=CoherenceConsole)
        )
      RecycleMillis=1200000
      RecycleSet=MemberSet(Size=0, BitSetCount=0
        )
      )
     
    TcpRing{Connections=[1]}
    IpMonitor{AddressListSize=0}
     
    2010-05-26 14:15:10.296/2.453 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Invocation:Management, member=2): Service Management joined the cluster with senior service member 1
     
    Map (?):
    

1.3.3 Exercise the Sample Cache Client Application

Exercise the cache client application by entering various commands and examining the output.

  1. Execute the following Coherence commands in the cache client:

    • Enter help to see the list of commands that are available.

    • Enter cache myCache to create a cache named myCache.

      The cache myCache implements the com.tangosol.net.NamedCache interface. A cluster can have many named caches.

      Example 1-5 illustrates that using the default configuration files (coherence-cache-config.xml) within the supplied coherence.jar file, a NamedCache called myCache is created using the distributed scheme:

      Example 1-5 Output from Starting a Coherence Cache

      Map (?): cache myCache
      2010-05-26 15:00:09.296/2701.453 Oracle Coherence GE 3.6.0.0 DPR3 <Info> (thread=main, member=2): Loaded cache configuration from "jar:file:/C:/oracle/product/coherence/lib/coherence.jar!/coherence-cache-config.xml"
      2010-05-26 15:00:09.515/2701.672 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=DistributedCache, member=2): Service DistributedCache joined the cluster with senior service member 1
      <distributed-scheme>
        <scheme-name>example-distributed</scheme-name>
        <service-name>DistributedCache</service-name>
        <backing-map-scheme>
          <local-scheme>
            <scheme-ref>example-binary-backing-map</scheme-ref>
          </local-scheme>
        </backing-map-scheme>
        <autostart>true</autostart>
      </distributed-scheme>
       
      Map (myCache):
      
  2. Execute the following commands at the Map(myCache) prompt in the cache client. For definitions of these commands, see Appendix A, "Coherence Client Application Commands."

    • get message

    • put message "hello"

    • list

    • size

    • get message

    • put message "second message"

    • get message

    • remove message

    • size

    • get message

    • put message "hi"

    • bye

    Example 1-6 illustrates the output of each of these commands.

    Example 1-6 Exercising Coherence Commands

    Map (mycache): get message
    null
    
    Map (mycache): put message "hello"
    null
    
    Map (mycache): list
    message = hello
    
    Map (mycache): size
    1
    
    Map (mycache): get message
    hello
    
    Map (mycache): put message "second message"
    hello
    
    Map (mycache): get message
    second message
    
    Map (mycache): remove message
    second message
    
    Map (mycache): size
    0
    
    Map (mycache): get message
    null
    
    Map (mycache): put message "hi"
    null
    
    Map (myCache): bye
    2010-05-26 15:03:28.968/2901.125 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Invocation:Management, member=2): Service Management left the cluster
    2010-05-26 15:03:28.984/2901.141 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=DistributedCache, member=2): Service DistributedCache left the cluster
    2010-05-26 15:03:29.093/2901.250 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=2): Service Cluster left the cluster
     
    C:\oracle\product\coherence\bin>
    
  3. Open another terminal window and set the PATH environment variable to include %JAVA_HOME% and %JAVA_HOME%\bin. (See Step 4).

  4. Start a second instance of coherence.cmd in the new terminal window. Restart the first client. The terminal window displays a message similar to the following that describes where the first client is running. member 3 is the second client and Member 4 is the restarted first client.

    Map (myCache):
    2010-05-26 15:06:55.671/46.453 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=3): Member 4 joined Service Management with senior member 1
    
  5. Use the cache myCache command in the new terminal to connect to the NamedCache called myCache. Try to get and put values in different sessions. notice that each client can observe changes made by the other client.

  6. Terminate one of the coherence.cmd shells (bye). Note that the other shell displays a message indicating that the member has left the cluster. For example:

    Map (myCache):
    2010-05-26 15:20:52.156/317.375 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=5): MemberLeft announcement from Member(Id=3, Timestamp=2010-05-26 15:06:11.258, Address=130.35.99.213:8090, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:3708, Role=CoherenceConsole)
    2010-05-26 15:20:52.171/317.390 Oracle Coherence GE 3.6.0.0 DPR3 <D5> (thread=Cluster, member=5): Member(Id=3, Timestamp=2010-05-26 15:20:52.171, Address=130.35.99.213:8090, MachineId=49877, Location=site:us.oracle.com,machine:tpfaeffl-lap7,process:3708, Role=CoherenceConsole) left Cluster with senior member 1
    
  7. If you terminate each of the cache clients (bye), and then restart them, note that data from the previous session still available. This is because the data is held in the cache server.

  8. If you start another Coherence cache server, and then terminate the initial one that was started (using Ctrl+C or by closing the command window), note that the data is still available.

  9. Terminate both the coherence.cmd shells and cache-server.cmd shell. Re-start coherence.cmd. Create a NamedCache called test using the command cache test. Try to put in a value as before and note the results.

  10. Start a cache server by running the cache-server.cmd file from the coherence\bin directory. Try to put in a value again and note the results.

  11. Terminate all the cache servers.

1.3.4 Troubleshooting Cache Server Clustering

If the value of Member ID in the cache-server.cmd output is anything other than 1, then this indicates that the cache server has clustered with one or more other cache servers or processes running Coherence. These servers or processes may be running on the network or running locally on your host. Though this is the default behavior for Coherence—to cluster with other processes running Coherence locally or on a network—it is strongly advised, while you perform this tutorial, that you restrict Coherence to your own host.

1.3.4.1 Restricting Coherence to Your Own Host

The output of cache-server.cmd indicates whether you have just one member in your cluster. The value of Member ID should be equal to 1:

...
In MasterMemberSet
ThisMember=Member(Id should be equal to 1)
...

If Member ID is greater than 1, it means that multiple clusters are being formed in your subnet. For the purposes of the exercises in this document, there should only be one member in the cluster.

To restrict Coherence to your own host:

  1. Stop cache server by pressing Ctrl+C.

  2. Create a directory called backup under oracle\product\coherence\lib.

    cd C:\oracle\product\coherence\lib
    mkdir backup
    
  3. Copy coherence.jar from the oracle\product\coherence\lib directory to the backup directory.

    cp coherence.jar C:\oracle\product\coherence\lib\backup\coherence.jar
    
  4. Extract tangosol-coherence.xml from the original coherence.jar in the lib directory.

    jar -xvf coherence.jar tangosol-coherence.xml
    
  5. Edit the tangosol-coherence.xml file.

    Change the multicast listener port to a unique value, for example, 34408. For example, if you share the port value 34407 with another user, then change your port value to 34408 and the other user can change to 34409.

    Example 1-7 illustrates the multicast-listener fragment of tangosol-coherence.xml with its original port value of 34407.

    Example 1-7 Multicast-Listener Fragment of tangosol-coherence.xml File

        <multicast-listener>
          <address system-property="tangosol.coherence.clusteraddress">224.3.6.0</address>
          <port system-property="tangosol.coherence.clusterport">36000</port>
    
          <!--
          Note: For production use, this value should be set to the lowest integer
          value that works. On a single server cluster, it should work at "0"; on
          a simple switched backbone, it should work at "1"; on an advanced backbone
          with intelligent switching, it may require a value of "2" or more. Setting
          the value too high can utilize unnecessary bandwidth on other LAN segments
          and can even cause the OS or network devices to disable multicast traffic.
          -->
          <time-to-live system-property="tangosol.coherence.ttl">4</time-to-live>
    
  6. Use the Java jar command or your favorite compression utility to append the modified tangosol-coherence.xml file to coherence.jar.

    When you execute cache-server.cmd, you should be able to view the modified port. Also, your cluster should now be restricted to your own host. If Membership ID still displays something other than 1, then there may be additional issues with the installation. See "Advanced Steps to Restrict Coherence to Your Own Host".

1.3.4.2 Advanced Steps to Restrict Coherence to Your Own Host

If you follow the steps in the previous section and cache-server.cmd still fails to return a Member Id value of 1, then there may be additional issues to resolve.

Disconnect from the network or disable networking on your host. If errors or exceptions occur when starting the cache server, your network settings might need to be modified. Try each of the following one at a time, restarting the cache server between each attempt:

  • If connected to a VPN, disconnect from it. By default, most VPN networks are not configured to permit multicast and some unicast traffic. In this environment, Coherence may not work as it is configured out-of-the-box. Coherence can be configured to run across a VPN, but this requires some advanced settings.

  • If you run a firewall, configure it to allow the specified addresses and ports.

  • If you still experience problems, unplug or disconnect from all the networks. This includes wireless and wired networks.

  • If all the preceding options fail, set up Coherence to run on a single host.