When learning elasticsearch, write the code to ehcahce index. When starting the project, an error is reported in the error creating bean with name ‘mappingjackson2httpmessageconverter’.
So I looked for the jar package in lib and found that Jackson’s package was introduced. However, no dependency is introduced into the POM file. I checked the related dependencies and found that they were introduced from the high-level client
It seems to be a necessary package for elastic advanced client. To test this conjecture, I deleted all the jar packages of Jackson and started it. The project did start successfully, but an error occurred when sending the index request, that is, in this line of code indexrequest.Source (JSON)
.
It seems that it is a necessary package. But I didn’t find the right answer on the Internet. To solve this problem, I manually introduced Jackson into
Then delete all the jar packages that do not belong to my imported Jackson.
the red box part is the jar package I manually imported, and the blue part is the jar package automatically imported by the advanced client. Manually delete the jar package in blue. The measured items can be started normally and the index request can be sent
However, there is a fatal problem, that is, if reload maven, the jar package in the blue part will be automatically introduced. To solve this problem, we must first find out which jar packages are introduced into our POM file, and then ignore these jar packages using the exclusion method. Finally, my POM file is shown below
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.12.RELEASE</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.2.1</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml</groupId>
<artifactId>jackson-xml-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-smile</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- json包 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
Read More:
- How to Solve Error creating bean with name ‘log’loginController’
- How to Solve elasticsearch root user start Error
- How to Solve elasticsearch-7.15.1 operation errors
- How to Solve elasticSearch8.1.2 Install Error in Win10
- Spring cloud Eureka error creating bean with name
- How to Solve Client-go Mod Error
- How to Solve elasticsearch and logstash Install Error
- Error creating bean with name ‘redistemplate’ defined in class path resource
- How to Solve Docker Error: elasticsearch exception: type=cluster_block_exception, reason=blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];
- [Solved] Redis Error: Error creating bean with name stringRedisTemplate defined in class path resource
- How to Solve kubelet starts error (k8s Cluster Restarted)
- When integrating redis with SSM framework, error creating bean with name ‘rediscontentserviceimpl’ defined in file
- SpringBoot Access Clickhouse Error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘jdbcConverter’ defined in class path resource [***.class]
- [Elasticsearch Exception]Found interface org.elasticsearch.common.bytes.BytesReference
- [Solved] Elasticsearch.service failed after enable elasticsearch security features
- IDEA: How to Solve Springboot Project install Error
- [Solved] UnsatisfiedDependencyException: Error creating bean with name
- Eureka unit test error creating bean with name ‘Eureka autoservice registration’: Singleton bean
- [Solved] Error creating bean with name ‘braveHttpServerHandler‘ defined in class path
- Error creating bean with name ‘studentMapper‘ defined in file