Failed to instantiate [org.elasticsearch.client.transport.TransportClient]

11680 단어
Springboot 통합 ElasticSearch, springboot 오류는 다음과 같습니다.
Error starting ApplicationContext. To display the  auto-configuration report re-run your application with  'debug' enabled.
2019-05-15 09:06:40.948 ERROR 15032 --- [  restartedMain]  o.s.boot.SpringApplication               : Application  startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name  'elasticsearchDemoController': Unsatisfied dependency  expressed through field 'client'; nested exception is  org.springframework.beans.factory.BeanCreationException:  Error creating bean with name 'getTransportClient'  defined in class path resource  [cn/xdf/springboot/config/ESConfig.class]: Bean  instantiation via factory method failed; nested exception  is org.springframework.beans.BeanInstantiationException:  Failed to instantiate  [org.elasticsearch.client.transport.TransportClient]:  Factory method 'getTransportClient' threw exception;  nested exception is java.lang.NoClassDefFoundError:  org/apache/logging/log4j/Logger
     at  org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)  ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)  ~[spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
     at  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)  [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
     at  org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)  [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
     at  org.springframework.boot.SpringApplication.run(SpringApplication.java:303)  [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
     at  org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)  [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
     at  org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)  [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE]
     at  cn.xdf.springboot.Application.main(Application.java:18)  [classes/:na]
     at  sun.reflect.NativeMethodAccessorImpl.invoke0(Native  Method) ~[na:1.8.0_65]
     at  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
     at  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
     at java.lang.reflect.Method.invoke(Method.java:497)  ~[na:1.8.0_65]
     at  org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)  [spring-boot-devtools-1.5.9.RELEASE.jar:1.5.9.RELEASE]
Caused by:  org.springframework.beans.factory.BeanCreationException:  Error creating bean with name 'getTransportClient'  defined in class path resource  [cn/xdf/springboot/config/ESConfig.class]: Bean  instantiation via factory method failed; nested exception  is org.springframework.beans.BeanInstantiationException:  Failed to instantiate  [org.elasticsearch.client.transport.TransportClient]:  Factory method 'getTransportClient' threw exception;  nested exception is java.lang.NoClassDefFoundError:  org/apache/logging/log4j/Logger
     at  org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)  ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     ... 24 common frames omitted
Caused by:  org.springframework.beans.BeanInstantiationException:  Failed to instantiate  [org.elasticsearch.client.transport.TransportClient]:  Factory method 'getTransportClient' threw exception;  nested exception is java.lang.NoClassDefFoundError:  org/apache/logging/log4j/Logger
     at  org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     at  org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
     ... 36 common frames omitted

누르다
elasticsearch 이전 버전 2.x(2.4.6) 는 maven 파일을 참조할 때 다음과 같습니다.
Failed to instantiate [org.elasticsearch.client.transport.TransportClient]
org.elasticsearch.client 저버전 보고서에서 getTransport Client를 찾을 수 없음()
이것은
elasticsearchx를 시작해야 이 새로운jar 패키지가 있습니다. 아래와 같이 인용해야 합니다.
          
              org.elasticsearch
              elasticsearch
              5.2.2
          

또한elasticsearch5.x에log4j의 의존이 필요합니다. 추가해야 합니다.pom.xml에 다음과 같은 maven 구성을 추가합니다.
        
            org.apache.logging.log4j
            log4j-api
            2.7
        
        
            org.apache.logging.log4j
            log4j-core
            2.7
        

 
스프링부트를 다시 시작하는 데 성공했습니다.
(뒤에 의하면 제 엘라스틱 검색은 윈도우즈-6.2.2 버전이고 엘라스틱 검색은 최소 5.6.0 버전이 필요합니다. 스프링 부팅은 정상적으로 시작되지만 위에 도입된 5.2.2는 엘라스틱 검색-6.2.2-Windows 백그라운드 오류를 초래할 수 있습니다!)
 
 
 
다음으로 전송:https://www.cnblogs.com/zs-notes/p/10868346.html

좋은 웹페이지 즐겨찾기