How to add classpath when validating offline diskstore using gfsh in VMware GemFire
search cancel

How to add classpath when validating offline diskstore using gfsh in VMware GemFire

book

Article ID: 294328

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

After making backups for the persistent data from members to a specified directory, you might need to use the gfsh command to validate whether online persistence diskstores or to backup offline diskstores that have any disk corruptions.

If there are custom objects or classes associated with the regions in the disk stores, as the following example shows, you may encounter a ClassNotFoundException when validating the offline disk store with gfsh.

The problem is that custom classes/packages are not included in the classpath, and the '--J' option or '--classpath' do not work as parameters for the 'gfsh validate offline-disk-store' script.
Cluster-1 gfsh>validate offline-disk-store --name=data-disk-store --disk-dirs=/path/to/disk-store/dir
Validating data-disk-store
/app-product-details: entryCount=0
/app-network: entryCount=0
/app-code-master: entryCount=0
/app-search-index entryCount=0 bucketCount=7
/app-cot entryCount=0 bucketCount=3
/app-source-pid-xref entryCount=0 bucketCount=7
/app-ext-system-entity-xref entryCount=0 bucketCount=7
/app-membership entryCount=0 bucketCount=7
/app-indicator entryCount=0 bucketCount=7
/app-genkey-xref entryCount=0 bucketCount=7
/app-person entryCount=0 bucketCount=7
/app-coverage-ancillary entryCount=0 bucketCount=8
/app-person-pid-xref entryCount=0 bucketCount=7
/app-person-attributes entryCount=0 bucketCount=7
Error in validating disk store data-disk-store is : A ClassNotFoundException was thrown while trying to deserialize cached value.

The question is then, how do we add classpath to avoid the above mentioned ClassNotFoundException, so that we are able to verify using gfsh?

This article shows you how to add classpath when validating offline diskstore using gfsh.

Environment

Product Version: 9.1

Resolution

Before executing the gfsh command to validate the disk stores, find the path to custom objects or classes associated with the regions in the disk stores. Then update the classpath:
export CLASSPATH=/path/to/classes

Then execute the following gfsh command to validate the disk stores:
gfsh -e "connect --locator=localhost[port]" -e "validate offline-disk-store --name=data_store --disk-dirs=/path/to/disk-store/dir"

The above command will be executed behind the scenes:
gfsh -e "connect --locator=localhost[port]" -e "validate offline-disk-store --name=data_store --disk-dirs=/path/to/disk-store/dir"
/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java -Dgfsh=true -Dlog4j.configurationFile=classpath:log4j2-cli.xml -classpath apache-geode/lib/gfsh-dependencies.jar:/path/to/classes:apache-geode/extensions/* org.apache.geode.management.internal.cli.Launcher -e connect --locator=localhost[port] -e validate offline-disk-store --name=data_store --disk-dirs=/path/to/disk-store/dir