springcloud同时集成mysql和elasticsearch常见的三个错误
这个错误是因为将mysql的mapper接口和elasticsearch的mapper接口写在一起,系统找不到elasticsearch的mapper接口产生的。
只要将两个的mapper接口分类装就可以了,最好在启动类上面加上两个mapper接口路径的注解。
如果遇到这个报错是因为application.properties文件中缺少elasticsearch的配置,加以下的配置代码就可以解决
spring.data.elasticsearch.repositories.enabled=true
spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300
这个9300端口千万不能写成9200
failed to load elasticsearch nodes : org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{FYAflCpKRjyYD5WdphttTw}{127.0.0.1}{127.0.0.1:9300}]
如果是在控制台报错error(以上报错) 但是系统可以正常启动,但是elasticsearch压根就不能运行,这是因为springboot的版本号与elasticsearch的版本号不兼容,可以更改elasticsearch的版本