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

huangapple go评论73阅读模式
英文:

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

问题

我正在我的一个网页应用程序中使用Apache Geode。
我正在在Apache Geode的cache-server.xml文件中将自定义类用作值约束。
如果在XML文件中未指定value-constraint,则我可以启动服务器。但是,如果指定了value-constraint,那么在运行服务器时我会收到以下错误消息:

Exception in thread "main" org.apache.geode.cache.CacheXmlException: 读取缓存XML文件:/C:/localfolder/cache-server.xml时。无法加载value-constraint类:myPackage.Test,原因是java.lang.ClassNotFoundException: myPackage.Test

以下是我的startserver.bat文件内容:

> 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"

请告诉我:

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

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

得分: 1

以下是翻译好的内容:

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

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

英文:

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.

huangapple
  • 本文由 发表于 2020年10月5日 21:52:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/64210037.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定