在Apache Geode中将自定义类对象设置为键/值

问题描述

我在一个Web应用程序中使用Apache Geode。 我将Custom类用作Apache Geode cache-server.xml文件中的值约束。 如果在XML文件中未指定value-constraint,则可以启动服务器。但是,如果指定了值约束,那么在运行服务器时,我将遇到错误

线程“主”中的异常org.apache.geode.cache.CacheXmlException:读取Cache XML文件时:/ C:/localfolder/cache-server.xml。无法加载由java.lang.ClassNotFoundException:myPackage.Test引起的值约束类:myPackage.Test

下面是我的startserver.bat文件内容

gfsh启动服务器--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”

请让我知道

  1. 如何在XML文件中提供自定义类对象作为键值约束?
  2. 在服务器启动过程中如何使用war文件?

解决方法

类路径( Gfsh 选项,通常指向java启动器)不能引用WAR文件;必须是一个JAR文件(包含您的应用程序域类)。

WAR文件和JAR文件具有相似但明显不同的格式。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...