首页 > 编程语言 >使用java client连接ES7.17.20时报错:Caused by: java.lang.NoClassDefFoundError: Could not initialize class co

使用java client连接ES7.17.20时报错:Caused by: java.lang.NoClassDefFoundError: Could not initialize class co

时间:2024-04-14 11:22:06浏览次数:22  
标签:lang 20 java 2.17 RELEASE jackson com fasterxml

1.报错详情

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.databind.cfg.DatatypeFeatures$DefaultHolder
	at com.fasterxml.jackson.databind.cfg.DatatypeFeatures.defaultFeatures(DatatypeFeatures.java:33) ~[jackson-databind-2.17.0.jar:2.17.0]
	at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:701) ~[jackson-databind-2.17.0.jar:2.17.0]
	at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:605) ~[jackson-databind-2.17.0.jar:2.17.0]
	at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:650) ~[spring-web-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.<init>(MappingJackson2HttpMessageConverter.java:59) ~[spring-web-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:76) ~[spring-web-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.web.filter.FormContentFilter.<init>(FormContentFilter.java:61) ~[spring-web-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	at org.springframework.boot.web.servlet.filter.OrderedFormContentFilter.<init>(OrderedFormContentFilter.java:29) ~[spring-boot-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration.formContentFilter(WebMvcAutoConfiguration.java:178) ~[spring-boot-autoconfigure-2.3.12.RELEASE.jar:2.3.12.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_311]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_311]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_311]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_311]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]
	... 56 common frames omitted

2.报错解决

原因:缺少jackson相关依赖
引入以下两个依赖解决上述报错:

      <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-core</artifactId>
          <version>2.17.0</version>
      </dependency>
      <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-annotations</artifactId>
          <version>2.17.0</version>
      </dependency>

3.依赖参考


        <dependency>
            <groupId>co.elastic.clients</groupId>
            <artifactId>elasticsearch-java</artifactId>
            <version>7.17.20</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.0.1</version>
        </dependency>

参考:
参控

标签:lang,20,java,2.17,RELEASE,jackson,com,fasterxml
From: https://www.cnblogs.com/rong-xu-drum/p/18133890

相关文章

  • JavaScript基础
    JavaScript一、js编写位置位置1:script标签中<scripttype="text/javascript"> vara=1;...</script>位置2:标签中绑定事件<buttononlick="alert(123);">Click</button>位置3:超链接的href属性中<ahref="javascript:alert('......
  • [NOIP2018] 旅行 题解
    明显要以\(1\)为起点。原图是树这种情况下,走路不能回头,只能用\(dfs\)的思路走。当然肯定每次都走较小的那棵子树,\(vector\)存图后排序即可达到这种效果。时间复杂度\(O(n\logm)\)。原图是基环树明显可以分别考虑将所有边断掉后的情况,取字典序最小的。时间复杂度\(O(......
  • Java中的matches()方法与find()方法区别
    正则表达式用于在字符串中进行模式匹配。在处理字符串时,经常需要使用matches()方法和find()方法来查找与正则表达式匹配的部分。虽然它们都用于匹配字符串,但有一些重要的区别。matches()方法matches()方法是String类中的一个方法,用于判断整个字符串是否与给定的正则表达......
  • POI2010 ANT-后面忘了
    刚学字符串,随便打打Hash基础题就打到了这道,然后阴差阳错入坑Manacher算法,再也回不过头了。这道题让你求反对称子串个数,就是在亦或意义下的回文子串,于是毅然决然选择了放弃在\(O(n)\)的马拉车(最后补回来了),所以两个做法都写写吧。Hash这道题让你求回文串的数量,考虑如何判定......
  • Python常用模块-20个常用模块总结
    目录time模块datetime模块random模块os模块sys模块json和pickle模块hashlib和hmac模块logging模块numpy模块pandas模块matplotlib模块re模块typing模块collections模块pathlib模块shutil模块xml模块subprocess模块configparser模块Python常用模块小结time模块......
  • 2024-04-13:用go语言,给定一个整数数组 `nums`, 请编写一个函数,返回一个新的数组 `counts
    2024-04-13:用go语言,给定一个整数数组nums,请编写一个函数,返回一个新的数组counts。满足以下条件:对于每个nums[i],counts[i]表示在nums[i]右侧且比nums[i]小的元素数量。输入:nums=[5,2,6,1]。输出:[2,1,1,0]。答案2024-04-13:来自左程云。灵捷3.5大体过程如下:给定......
  • 大公司的Java面试题集
    找工作要面试,有面试就有对付面试的办法。以下一些题目来自我和我朋友痛苦的面试经历,提这些问题的公司包括IBM,E*Trade,Siebel,Motorola,SUN, 以及其它大小公司。面试是没什么道理可讲的,它的题目有的不合情理、脱离实际。有在纸上写的,有当面考你的,也有在电话里问的,给你IDE的......
  • 2024.4.13 模拟赛总结
    坑点总结:1.关于数据顺序模拟赛T1题面清明节,又称祭祖节,在每年4月4日至6日之间,是祭祀、祭祖和扫墓的节日。小明的爸爸妈妈决定清明假期带着他回老家扫墓。小明的爸爸一共要开车行驶1000千米才能到家,现在沿途有N个旅馆,为了安全起见,每天晚上都不开车,住在旅馆里(晚上不可以......
  • MySQL 8 显示错误代码2058
    在使用mysql-uroot-P3307-proot和SQLyong连接MySQL时报错1.在MySQL8.3CommandLineClient登录点击查看代码Enterpassword:****WelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis14Serverversion:8.3.0MySQLCommunitySer......
  • 今天我们来聊一聊Java中的Semaphore
    写在开头在上几天写《基于AQS手写一个同步器》时,很多同学留言说里面提到的Semaphore,讲得太笼统了,今天趁着周末有空,咱们就一起详细的学习和梳理一把Semaphore。什么是Semaphore?在前面我们讲过的synchronized和ReentrantLock都是一次只允许一个线程访问某个资源,而Semaphore(......