java - Infinispan:为缓存“测试”提供的配置缺少它的命名配置
问题描述
我正在尝试更多地了解 infispan ,并且如文档中所述,我克隆了教程repo。为了轻松上手,我使用了官方的docker 镜像(我尝试了各种标签,包括但不限于 13.0.0.Dev01、13.1、latest)。
不幸的是,例如,当尝试启动远程缓存教程时InfinispanRemoteContinuousQuery
,我收到以下错误:
WARN: ISPN004005: Error received from the server: org.infinispan.commons.CacheConfigurationException: ISPN005031: The supplied configuration for cache 'test' is missing a named configuration for it: <distributed-cache name="test">
<encoding media-type="application/x-protostream"/>
</distributed-cache>
Exception in thread "main" org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for messageId=7 returned server error (status=0x85): org.infinispan.commons.CacheConfigurationException: ISPN005031: The supplied configuration for cache 'test' is missing a named configuration for it: <distributed-cache name="test">
<encoding media-type="application/x-protostream"/>
</distributed-cache>
at org.infinispan.client.hotrod.impl.protocol.Codec20.checkForErrorsInResponseStatus(Codec20.java:333)
[..]
由于这些是教程,我显然还不知道我在做什么,我不知道配置中缺少什么,代码看起来像这样......
public static final String USER = "Titus Bramble";
public static final String PASSWORD = "Shambles";
public static final String TUTORIAL_CACHE_NAME = "test";
public static final String HOST = "127.0.0.1";
public static final String TUTORIAL_CACHE_CONFIG =
"<distributed-cache name=\"CACHE_NAME\">\n"
+ " <encoding media-type=\"application/x-protostream\"/>\n"
+ "</distributed-cache>";
/**
* Returns the configuration builder with the connection information
*
* @return a Configuration Builder with the connection config
*/
public static final ConfigurationBuilder connectionConfig() {
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.addServer().host("127.0.0.1").port(ConfigurationProperties.DEFAULT_HOTROD_PORT).security()
.authentication()
//Add user credentials.
.username(USER)
.password(PASSWORD);
// Docker 4 Mac Workaround. Don't use BASIC intelligence in production
builder.clientIntelligence(ClientIntelligence.BASIC);
// Make sure the remote cache is available.
// If the cache does not exist, the cache will be created
builder.remoteCache(TUTORIAL_CACHE_NAME)
.configuration(TUTORIAL_CACHE_CONFIG.replace("CACHE_NAME", TUTORIAL_CACHE_NAME));
return builder;
}
/**
* Connect to the running Infinispan Server in localhost:11222.
*
* This method illustrates how to connect to a running Infinispan Server with a downloaded
* distribution or a container.
*
* @return a connected RemoteCacheManager
*/
public static final RemoteCacheManager connect() {
ConfigurationBuilder builder = connectionConfig();
RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build());
// Clear the cache in case it already exists from a previous running tutorial
cacheManager.getCache(TUTORIAL_CACHE_NAME).clear();
// Return the connected cache manager
return cacheManager;
}
这是一个 Infinispan 问题还是我只是在这里遗漏了一步?
解决方案
推荐阅读
- php - 是否可以通过 Google Drive API 的 HTTP 请求下载 Google Drive 共享文件夹中的 csv 文件?
- java - 我可以检测我的应用程序是否已被用户在 Android 中安装过吗?
- mocha.js - 无法测试包含 import nestJS 的类
- javascript - 计算嵌套对象js中的填充字段
- node.js - 定义队列将在 Nodejs 中接受的消息类型
- ios - Xcode 12.5 M1 Interface Builder找不到框架
- python - 从 groupBy 中分离列会导致 pandas
- javascript - 当我在选择标签中选择一个选项时如何打开一个新标签?
- javascript - 如何在 hbs 文件中使用外部文件中的 javascript 方法
- spring-batch - Spring Batch - 我们可以在循环中使用日期列从数据库中读取项目吗