如何通过java查询ignite缓存?
How to query ignite cache by java?
我通过 ./[=22= 启动 ignite 服务器,通过 java 代码启动 ignite 客户端,并在 java、
中执行查询
public class TOFListener {
public static void main(String[] args) {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setClientMode(true);
//cfg.setPeerClassLoadingEnabled(true);
Ignite ignite = Ignition.start(cfg);
IgniteCache<String, Object> cache = ignite.getOrCreateCache("TOFCache");
ContinuousQuery<String, Object> qry = new ContinuousQuery<>();
qry.setInitialQuery(new ScanQuery<>((k, v) -> "name".equals(k) || "shoulderWidthStdDev".equals(k)));
qry.setLocalListener((evts) -> evts.forEach(e ->
System.out.println("UpdatedValue, [key=" + e.getKey() + ", val=" + e.getValue() + "]")));
qry.setRemoteFilterFactory(() -> evts -> evts.getKey().equals("name") || evts.getKey().equals("shoulderWidthStdDev"));
cache.query(qry);
}
}
但是出现了这样的异常:
Exception01
Exception02 Exception03
但是当我通过java代码启动ignite服务器时,查询没问题,
我不知道为什么,任何人都可以帮助我吗?谢谢...
Class 在服务器节点上不存在,因此无法在那里实例化您的 lambda。
您应该启用 Peer Class Loading,或者将您的代码作为 JAR 部署到服务器节点。
我通过 ./[=22= 启动 ignite 服务器,通过 java 代码启动 ignite 客户端,并在 java、
中执行查询public class TOFListener {
public static void main(String[] args) {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setClientMode(true);
//cfg.setPeerClassLoadingEnabled(true);
Ignite ignite = Ignition.start(cfg);
IgniteCache<String, Object> cache = ignite.getOrCreateCache("TOFCache");
ContinuousQuery<String, Object> qry = new ContinuousQuery<>();
qry.setInitialQuery(new ScanQuery<>((k, v) -> "name".equals(k) || "shoulderWidthStdDev".equals(k)));
qry.setLocalListener((evts) -> evts.forEach(e ->
System.out.println("UpdatedValue, [key=" + e.getKey() + ", val=" + e.getValue() + "]")));
qry.setRemoteFilterFactory(() -> evts -> evts.getKey().equals("name") || evts.getKey().equals("shoulderWidthStdDev"));
cache.query(qry);
}
}
但是出现了这样的异常: Exception01 Exception02 Exception03
但是当我通过java代码启动ignite服务器时,查询没问题, 我不知道为什么,任何人都可以帮助我吗?谢谢...
Class 在服务器节点上不存在,因此无法在那里实例化您的 lambda。
您应该启用 Peer Class Loading,或者将您的代码作为 JAR 部署到服务器节点。