3.3.1 Using a Default Cache Configuration File
Coherence is configured out-of-box esta pГЎgina to use the first coherence-cache-config.xml file that is found on the classpath. To use a coherence-cache-config.xml file, the file must be located on the classpath and must precede the coherence.jar library; otherwise, the sample coherence-cache-config.xml file that is located in the coherence.jar is used.
Make a copy of the sample coherence-cache-config.xml file that is located in the coherence.jar and save it to a different location. The cache definitions that are included in the sample file are for demonstration purposes and are used as a starting point for creating solution-specific cache configurations.
Ensure that the location where the coherence-cache-config.xml file is saved is in the classpath at run time and that the location precedes the coherence.jar file in the classpath.
The following example demonstrates starting a cache server that uses a coherence-cache-config.xml cache configuration file that is located in COHERENCE_HOME .
3.3.2 Overriding the Default Cache Configuration File
The default name and location of the cache configuration deployment descriptor is specified in the operational deployment descriptor within the element. This element can be overridden to specify a different name an location to be used for the default cache configuration file.
Make a copy of the default coherence-cache-config.xml cache configuration file that is located in the coherence.jar and save it to a location with a different name.
Edit the operational override file and enter a node that specifies the name of the cache configuration file created in step 1. If the cache configuration file is not located in the classpath, enter the full (or relative) path to the file as well. The element also supports the use of a URL when specifying the location of a cache configuration file.
The following example demonstrates starting a cache server using an operational override file and a custom cache configuration file that are located in COHERENCE_HOME .
3.3.3 Using the Cache Configuration File System Property
The tangosol.coherence.cacheconfig system property is used to specify a custom cache configuration deployment descriptor to be used instead of the configured default cache configuration deployment descriptor. The system property provides an easy way to switch between different configurations and is convenient during development and testing.
To specify a custom cache configuration file, enter the name of the file as a value of the tangosol.coherence.cacheconfig system property. This is typically done as a -D Java option when starting a Coherence node. If the file is not located in the classpath, enter the full (or relative) path to the file and the name. The system property also supports the use of a URL when specifying the location of a cache configuration file.
The following example starts a cache server and specifies a cache configuration deployment descriptor called MyConfig.xml that is located in COHERENCE_HOME .
3.3.4 Viewing Which Cache Configuration File is Loaded
The output for a Coherence node indicates the location and name of the cache configuration deployment descriptor that is loaded at startup. The configuration message is the first message to display after the Coherence copyright text is emitted. The output is especially helpful when developing and testing Coherence applications and solutions.
The following example output demonstrates a cache configuration message which indicates that a cache configuration deployment descriptor named Myconfig.xml was loaded:
3.4 Specifying a POF Configuration File
The pof-config.xml POF configuration deployment descriptor file is used to specify custom user types when using Portable Object Format (POF) for serialization. At run time, Coherence uses the first pof-config.xml file that is found in the classpath.
A POF configuration deployment descriptor is only loaded if the POF serializer is either configured as part of a cache scheme or configured globally for all cache schemes. The default coherence-cache-config.xml provides an example cache scheme that defines the POF serializer, but it is commented out by default.