Setting up Custom class Object as Key/value in Apache Geode

204 views Asked by At

I am using Apache Geode in one of my web applications. I am using Custom class as a value-constraint in Apache Geode cache-server.xml file. If value-constraint is not specified in the XML file, then I am able to start the server. But if value-constraint is specified then while running the server I am getting below error

Exception in thread "main" org.apache.geode.cache.CacheXmlException: While reading Cache XML file:/C:/localfolder/cache-server.xml. Could not load value-constraint class: myPackage.Test, caused by java.lang.ClassNotFoundException: myPackage.Test

Below is my startserver.bat file contents

gfsh start server --server-port=12000 --dir=C:\localfolder\server --name=server123 --hostname-for-clients="someHost" --initial-heap=500m --max-heap=500m --bind-address="someAddress" --properties-file=gemfire.properties --server-properties-file=gfsecurity.properties --classpath="C:\localfolder\application.war"

Please let me know

  1. How to provide a custom class objects as a key-value constraint in the XML file?
  2. How to use war file, in the server start process?
1

There are 1 answers

1
John Blum On

The classpath (Gfsh option, and in general, to the java launcher) cannot refer to a WAR file; must be a JAR file (containing your application domain classes).

WAR files and JAR files have similar, but significantly different formats.