Pivotal Knowledge Base

Follow

How to add a jar to the locator classpath with GFSH in GemFire 8?

Applies To
GemFire 8.0

Issue
Unfortunately, in GemFire 8.0 you can't add a jar to the locator classpath with gfsh.

Solution
A work-around is to launch the locator using the LocatorLauncher directly with your application classes on the classpath.

GFSH launches a locator like below with only the locator-dependencies.jar on the classpath:

 

java -server -classpath /$GEMFIRE/lib/locator-dependencies.jar -DgemfirePropertyFile=/$PWD/config/gemfire-locator.properties -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.launcher.registerSignalHandlers=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806 com.gemstone.gemfire.distributed.LocatorLauncher start locator --port=10334 --redirect-output

Take that output, add your classes to the classpath and launch the locator directly in a script like:

 

java -server -classpath /$GEMFIRE/lib/locator-dependencies.jar:/path/to/application/classes.jar -DgemfirePropertyFile=/$PWD/config/gemfire-locator.properties -Dgemfire.enable-cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.launcher.registerSignalHandlers=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806 com.gemstone.gemfire.distributed.LocatorLauncher start locator --port=10334 --redirect-output

In GemFire 8.1 the 'start locator' GFSH command have a new "prepend" '--classpath' command-line option, like 'start server'. Both 'start locator/server' commands --classpath option will now have the "prepend" option as well.

Comments

Powered by Zendesk