Gemfire/gemstone gfsh region cache listener

257 Views Asked by At

I'm trying to create a region with defined cache listener via gfsh with the following command:

gfsh>create region --name=exampleRegion --type=REPLICATE --enable-statistics=true --cache-listener=com.example.RegionChangeListener

com.example.RegionChangeListener class is deployed (>deploy --jar=lib.jar) within jar but it does not seem to be working - I'm getting:

Could not process command due to GemFire error. java.lang.ClassNotFoundException cannot be cast to com.gemstone.gemfire.management.internal.cli.functions.CliFunctionResult

Looks like the class is not being found/recognised - where and how to "register" it so gemfire can initialise it properly? The class just extends CacheListenerAdapter and implements Declarable.

1

There are 1 best solutions below

6
On

>deploy --jar= is only used to deploy functions and not event handlers like listeners, loaders or writers.

Do this instead:

gfsh>create region --cp=<path to cache listener jar> --name=exampleRegion --type=REPLICATE --enable-statistics=true --cache-listener=com.example.RegionChangeListener