新接手的一个项目,怎么都启动不了 报错:
Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository]: Constructor threw exception; nested exception is com.github.vanroy.springdata.jest.exception.JestElasticsearchException: Cannot execute jest action , response code : 405 , error : 405 Method Not Allowed , message : null
断点跟进去后发现请求 es 一个地址出错了,http://192.168.x.x:9200//goods
, 返回 405,外部工具调用同样 405。去掉配置文件后的斜杆后就可以正常启动了。
郁闷的是,同样的代码,同事那边就可以运行成功,断点进去,就是这个地址,他那边 HEAD 请求回来就是 OK 的。然后他curl --head "http://192.168.x.x:9200//goods"
返回也是 405,那他代码是怎么请求成功的?
代码中的请求是 jest-6.3.1 执行的。
郁闷了。