问题
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'countryServiceImpl' defined in file [E:\tms-ws\TransportManagement\target\classes\com\baltransport\tms\app\v1\service\impl\CountryServiceImpl.class]:
Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'countrySearchRepository': Invocation of init method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.data.elasticsearch.repository.support.NumberKeyedRepository]:
Constructor threw exception; nested exception is org.springframework.data.elasticsearch.ElasticsearchException: Failed to build mapping for country:country
at org.springframework. ...
Getting this exception jHispter Elasticsearch issue after adding any custom entity .
It works perfectly fine first time (with default jdl)
回答1:
U can try:
- Delete db and create again.
- Import your jdl, with the news changes, maybe new entity.
- Run elasticsearch in docker. (Find this file .yml in your project) and check if this is run correctly (localhost:9200)
- Run your app (monolith or microservices)
Regards
回答2:
you can try to delete the indexes in elasticsearch directly from the url. Supposing you index is called "user" you can do the
DELETE /indexname
来源:https://stackoverflow.com/questions/55058416/jhispter-elasticsearch-issue-after-adding-any-custom-entity