jHispter Elasticsearch issue after adding any cust

2019-08-30 02:20发布

问题:

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:

  1. Delete db and create again.
  2. Import your jdl, with the news changes, maybe new entity.
  3. Run elasticsearch in docker. (Find this file .yml in your project) and check if this is run correctly (localhost:9200)
  4. Run your app (monolith or microservices)

Regards