- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Apache Geode 的新手,我正在尝试一个示例程序来存储日期,例如:
empid:col1:col2
1:10:15
我已经编写了一个示例程序,但在运行时它给出了如下错误:“在池中注册实例化器时出错:”。如果我浏览日志,我可以看到记录已插入到区域中,但在查询时我也会收到以下错误:
Result : false
startCount : 0
endCount : 20
Message : A ClassNotFoundException was thrown while trying to deserialize cached value.
分享完整代码。数据入口.java
package com.apache.geode;
import java.util.Map.Entry;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.query.FunctionDomainException;
import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.TypeMismatchException;
public class DataEntry {
public static void main(String[] args) throws FunctionDomainException,TypeMismatchException, NameResolutionException, QueryInvocationTargetException {
ClientCache cache = new ClientCacheFactory().addPoolLocator(
"10.77.17.17", 10334).create();
Region<String, CustomerValue> customer = cache
.<String, CustomerValue> createClientRegionFactory(
ClientRegionShortcut.CACHING_PROXY)
.setValueConstraint(CustomerValue.class)
.setKeyConstraint(String.class).create("custRegion");
CustomerValue customerValue = new CustomerValue(10, 15);
customer.put("1", customerValue);
System.out.println("successfully Put customer object into the cache");
for (Entry<String, CustomerValue> entry : customer.entrySet()) {
System.out.format("key = %s, value = %s\n", entry.getKey(),
entry.getValue());
}
cache.close();
}
消费者值(value).java
package com.apache.geode;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.Instantiator;
public class CustomerValue implements DataSerializable{
private static final long serialVersionUID = -5524295054253565345L;
private int points_5A;
private int points_10A;
static {
Instantiator.register(new Instantiator(CustomerValue.class, 45) {
public DataSerializable newInstance() {
return new CustomerValue();
}
});
}
public CustomerValue()
{
}
public CustomerValue(int points_5A,int points_10A)
{
this.points_10A=points_10A;
this.points_5A=points_5A;
}
public int getPoints_5A() {
return points_5A;
}
public void setPoints_5A(int points_5a) {
points_5A = points_5a;
}
public int getPoints_10A() {
return points_10A;
}
public void setPoints_10A(int points_10a) {
points_10A = points_10a;
}
@Override
public String toString()
{
return "customer [ 5Apoints=" + points_5A +",10Apoints=" + points_10A +"]";
}
public void fromData(DataInput in) throws IOException {
this.points_5A=in.readInt();
this.points_10A=in.readInt();
}
public void toData(DataOutput io) throws IOException {
io.writeInt(points_5A);
io.writeInt(points_10A);
}
输出日志:
[info 2015/08/13 14:28:23.452 UTC <main> tid=0x1] Running in local mode since mcast-port was 0 and locators was empty.
[info 2015/08/13 14:28:23.635 UTC <Thread-0 StatSampler> tid=0x9] Disabling statistic archival.
[config 2015/08/13 14:28:23.881 UTC <main> tid=0x1] Pool DEFAULT started with multiuser-authentication=false
[config 2015/08/13 14:28:23.938 UTC <poolTimer-DEFAULT-3> tid=0x13] Updating membership port. Port changed from 0 to 59,982.
[warning 2015/08/13 14:28:24.176 UTC <main> tid=0x1] Error registering instantiator on pool:
com.gemstone.gemfire.cache.client.ServerOperationException: : While performing a remote registerInstantiators
at com.gemstone.gemfire.cache.client.internal.AbstractOp.processAck(AbstractOp.java:257)
at com.gemstone.gemfire.cache.client.internal.RegisterInstantiatorsOp$RegisterInstantiatorsOpImpl.processResponse(RegisterInstantiatorsOp.java:140)
at com.gemstone.gemfire.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:219)
at com.gemstone.gemfire.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:167)
at com.gemstone.gemfire.cache.client.internal.AbstractOp.attempt(AbstractOp.java:373)
at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:261)
at com.gemstone.gemfire.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:323)
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:932)
at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:162)
at com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:660)
at com.gemstone.gemfire.cache.client.internal.RegisterInstantiatorsOp.execute(RegisterInstantiatorsOp.java:42)
at com.gemstone.gemfire.internal.cache.PoolManagerImpl.allPoolsRegisterInstantiator(PoolManagerImpl.java:219)
at com.gemstone.gemfire.internal.InternalInstantiator.sendRegistrationMessageToServers(InternalInstantiator.java:206)
at com.gemstone.gemfire.internal.InternalInstantiator._register(InternalInstantiator.java:161)
at com.gemstone.gemfire.internal.InternalInstantiator.register(InternalInstantiator.java:89)
at com.gemstone.gemfire.Instantiator.register(Instantiator.java:175)
at CustomerValue.<clinit>(CustomerValue.java:16)
at DataEntry.main(DataEntry.java:22)
Caused by: java.lang.ClassNotFoundException: CustomerValue$1
at com.gemstone.gemfire.internal.ClassPathLoader.forName (ClassPathLoader.java:422)
at com.gemstone.gemfire.internal.InternalDataSerializer.getCachedClass (InternalDataSerializer.java:4066)
at com.gemstone.gemfire.internal.cache.tier.sockets.command.RegisterInstantiators.cmdExecute(RegisterInstantiators.java:89)
at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:182)
at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doNormalMsg(ServerConnection.java:787)
at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doOneMessage(ServerConnection.java:914)
at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1159)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:580)
at java.lang.Thread.run(Thread.java:745)
successfully Put customer object into the cache
key = 1, value = customer [ 5Apoints=10,10Apoints=15]
[info 2015/08/13 14:28:24.225 UTC <main> tid=0x1] GemFireCache[id = 712610161; isClosing = true; isShutDownAll = false; closingGatewayHubsByShutdownAll = false; created = Thu Aug 13 14:28:23 UTC 2015; server = false; copyOnRead = false; lockLease = 120; lockTimeout = 60]: Now closing.
[info 2015/08/13 14:28:24.277 UTC <main> tid=0x1] Resetting original MemoryPoolMXBean heap threshold bytes 0 on pool PS Old Gen
[config 2015/08/13 14:28:24.329 UTC <main> tid=0x1] Destroying connection pool DEFAULT
最佳答案
您的 CustomerValue 类需要位于服务器的类路径中。请引用geode documentation关于如何将 jar 部署到服务器。
关于java - 如何在 Apache Geode 中存储多列数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31994751/
在流处理方面,Apache Beam和Apache Kafka之间有什么区别? 我也试图掌握技术和程序上的差异。 请通过您的经验报告来帮助我理解。 最佳答案 Beam是一种API,它以一种统一的方式使
有点n00b的问题。 如果我使用 Apache Ignite 进行消息传递和事件处理,是否还需要使用 Kafka? 与 Ignite 相比,Kafka 基本上会给我哪些(如果有的话)额外功能? 提前致
Apache MetaModel 是一个数据访问框架,它为发现、探索和查询不同类型的数据源提供了一个通用接口(interface)。 Apache Drill 是一种无架构的 SQL 查询引擎,它通过
Tomcat是一个广泛使用的java web服务器,而Apache也是一个web服务器,它们在实际项目使用中有什么不同? 经过一些研究,我有了一个简单的想法,比如, Apache Tomcat Ja
既然简单地使用 Apache 就足以运行许多 Web 应用程序,那么人们何时以及为什么除了 Apache 之外还使用 Tomcat? 最佳答案 Apache Tomcat是一个网络服务器和 Java
我在某个 VPS( friend 的带 cPanel 的 apache 服务器)上有一个帐户,我在那里有一个 public_html 目录。我们有大约 5-6 个网站: /home/myusernam
我目前正在尝试将模块加载到 Apache,使用 cmake 构建。该模块称为 mod_mapcache。它已成功构建并正确安装在/usr/lib/apache2/modules directroy 中
我对 url 中的问号有疑问。 例如:我有 url test.com/controller/action/part_1%3Fpart_2 (其中 %3F 是 url 编码的问号),并使用此重写规则:R
在同一台机器上,Apache 在端口 80 上运行,Tomcat 在端口 8080 上运行。 Apache 包括 html;css;js;文件并调用 tomcat 服务。 基本上 exampledom
Apache 1 和 Apache 2 的分支有什么区别? 使用一种或另一种的优点和缺点? 似乎 Apache 2 的缺点之一是使用大量内存,但也许它处理请求的速度更快? 最有趣的是 Apache 作
实际上,我们正在使用 Apache 网络服务器来托管我们的 REST-API。 脚本是用 Lua 编写的,并使用 mod-lua 映射。 例如来自 httpd.conf 的实际片段: [...] Lu
我在 apache 上的 ubuntu 中有一个虚拟主机,这不是我的主要配置,我有另一个网页作为我的主要网页,所以我想使用虚拟主机在同一个 IP 上设置这个。 urologyexpert.mx 是我的
我使用 Apache camel 已经很长时间了,发现它是满足各种系统集成相关业务需求的绝佳解决方案。但是几年前我遇到了 Apache Nifi 解决方案。经过一番谷歌搜索后,我发现虽然 Nifi 可
由于两者都是一次处理事件的流框架,这两种技术/流框架之间的核心架构差异是什么? 此外,在哪些特定用例中,一个比另一个更合适? 最佳答案 正如您所提到的,两者都是实时内存计算的流式平台。但是当您仔细观察
apache 文件(如 httpd.conf 和虚拟主机)中使用的语言名称是什么,例如 # Ensure that Apache listens on port 80 Listen 80 D
作为我学习过程的一部分,我认为如果我扩展更多关于 apache 的知识会很好。我有几个问题,虽然我知道有些内容可能需要相当冗长的解释,但我希望您能提供一个概述,以便我知道去哪里寻找。 (最好引用 mo
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 4 个月前关闭。 Improve
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
这个问题在这里已经有了答案: Difference Between Apache Kafka and Camel (Broker vs Integration) (4 个回答) 3年前关闭。 据我所知
我有 2 个使用相同规则的子域,如下所示: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond
我是一名优秀的程序员,十分优秀!