我需要你的帮助。我不知道这里怎么了。
当我启动javaapp从elasticsearch获取数据时,我得到了以下classcastexception:
ElasticDBPersistanceImp | findQueryField failed for templateId
java.lang.ClassCastException: org.elasticsearch.cluster.metadata.MappingMetadata cannot be cast to org.elasticsearch.cluster.metadata.MappingMetaData
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.getAllFields(ElasticDBPersistanceImpl.java:251) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.findQueryField(ElasticDBPersistanceImpl.java:226) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.getFieldDataDistict(ElasticDBPersistanceImpl.java:163) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.FormListSecurityServiceImpl.getTemplateIds(FormListSecurityServiceImpl.java:40) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.FormListSecurityServiceImpl.<init>(FormListSecurityServiceImpl.java:21) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.HformsFormlistFactoryImpl.<init>(HformsFormlistFactoryImpl.java:55) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.Booter.startTenant(Booter.java:70) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.Booter.lambda$0(Booter.java:45) ~[classes/:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
我使用的代码在这里的文档中提供https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-get-mappings.html
所以稍加修改,它看起来像:
GetMappingsResponse mapping1 = dbManager.getFormlistDBConnection().indices().getMapping(getMappingsRequest, RequestOptions.DEFAULT);
Map<String, MappingMetaData> mappings2 = mapping1.mappings();
MappingMetaData mappingMetaData = mappings2.get(indexName);
Map<String, Object> sourceAsMap = mappingMetaData.getSourceAsMap();
也许你们中有人知道这里出了什么问题?
提前谢谢
1条答案
按热度按时间n1bvdmb61#
经过几个小时的搜索,似乎这是一个查与maven的问题。
删除我的本地maven repo后,重新加载源代码,现在似乎可以工作了。