This section provides procedures and examples for deploying configuration files as jar files.
Process
- Package the file as a jar package.
- Set the Apache Geode system property to point to the file in the jar file.
把jar文件包括到你的类路径中。
- Verify that the copy of the file is the only copy of the file visible in the runtime application. The classpath is searched after searching elsewhere, so the file is not available in other search areas.
- Start your application and the configuration file in the jar file will be loaded.
Example of deployment configuration jar
The following example deploys the cache configuration file, in my.jarmyCache.xml。如下的显示为my.jar的内容:
% jar -tf my.jar META-INF META-INF/MANIFEST.MF myConfig/ myConfig/myCache.xml
In this example, you should deploy the configuration jar file as follows:
- Set the system property,
gemfire.cache-xml-file
, tomyConfig/myCache.xml
- Setting the classpath includes
my.jar
. - The current directory location of the file checks
./myConfig/myCache.xml
that there is no file namedmyCache.xml
in .
When you start the application, the configuration files in the jar file will be loaded.