elastic search spring boot - java

I am trying to connect to Elastic Cluster. ES version 6.2.0 and client version 6.2.0
when i try to connect i get the below error.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [com/dct/search/sync/ElasticSearch/ElasticSearchConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.elasticsearch.client.Client]: Factory method 'client' threw exception; nested exception is java.lang.NoClassDefFoundError: org/elasticsearch/common/logging/Loggers
The error is "org/elasticsearch/common/logging/Loggers" not "org/apache/logging/log4j/Logger"
Can someone please help me out.

Related

Spring Cloud Config Server doens't work with Docker build

Hello and thanks for your attention! I got a problem trying to Dockerize my Spring Cloud Config Server using Git for managing my microservices. My app working oke when it's just Spring Cloud microservices context, but when i create the Dockerfile for this Config Server, and build-it, i got the next error:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configServerHealthIndicator' defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method 'configServerHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configServerHealthIndicator' defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method 'configServerHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configServerHealthIndicator' defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method 'configServerHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository.
Caused by: java.lang.IllegalStateException: You need to configure a uri for the git repository.
But i have a gitRepo in my bootstrap.yml, and it's working when i use it without Dockerfile:
spring:
application:
name: CONFIG-SERVER
profiles:
active:
- git
cloud:
config:
server:
git:
default-label: main
uri: https://github.com/hideyourname/cloud-config-server.git
Soo... i think i have a problem with the way i created Dockerfile because it's can find my git even if is there
FROM openjdk:11 as BUILDER
LABEL maintainer = "petrea config server"
#EXPOSE 8080 SA VEDE MDACA MERGE
COPY /target/boys-config.jar boys-config.jar
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf /boys-config.jar)
#Stage 2
FROM openjdk:11-slim
VOLUME /tmp
ARG DEPENDENCY=/target/dependency
COPY --from=BUILDER ${DEPENDENCY}/BOOT-INF/lib /boys-config/lib
COPY --from=BUILDER ${DEPENDENCY}/META-INF /boys-config/META-INF
COPY --from=BUILDER ${DEPENDENCY}/BOOT-INF/classes /boys-config
#execute the application
ENTRYPOINT ["java", "-cp", "boys-config:boys-config/lib/*", "com.petrea.boys-config-server.BoysConfigServerApplication"]
I have Cloud Config Server dependency in POM, #EnableConfigServer in my main class, but for some reason, when i use Dockerfile for building this image, it's failing... any thoughts please?
If you are following the examples in the book referenced above, I will suggest you move the below snippet from bootsrap.yml to applications.yml.
spring:
application:
name: CONFIG-SERVER
profiles:
active:
- git
cloud:
config:
server:
git:
default-label: main
uri: https://github.com/hideyourname/cloud-config-server.git
That's what I did and it worked for me.

Error creating bean with name 'graphQlUtility' defined in URL

My Application runs fine locally but when I deploy it to cloudservice, I am getting this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphQlImpl' defined in URL [jar:file:/profile-0.0.1-SNAPSHOT.jar!/BOOT- Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate.
Could someone help me to figure out what is causing this error.

javax.naming.NameNotFoundException: fsmDS not bound

I am migrating my spring jsf project from ANT to maven, while deploying in jboss 5 server getting below error.
ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyLoaderJob' defined in ServletContext resource [/WEB-INF/property.xml]: Cannot resolve reference to bean 'propertyloader' while setting bean property 'targetObject'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertyloader' defined in ServletContext resource [/WEB-INF/property.xml]: Cannot resolve reference to bean 'dataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ServletContext resource [/WEB-INF/DataSource.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: fsmDS not bound
The exception means that JDBC driver is missed.Please check if you have JDBC driver dependency in pom.xml.

Solace - Failed to create InitialContext when the solace jar was upgraded to v10.1

We have upgraded the solace version from 7.1 to 10.1 for an existing spring based application. After upgrading it, we started the application and observed the below error. Is new solace jar causing this error?
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solaceConnectionFactory' defined in class path resource [SolRes.xml]: Invocation of init method failed; nested exception is javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable [Root exception is java.lang.NullPointerException]

Jetty8 and Java Bean tmp failed

<code>[ERROR] 2016-01-23 14:48:41,925 [main] org.springframework.web.context.ContextLoader {} - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.config.ConsumerEndpointFactoryBean#54': Cannot resolve reference to bean 'org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#10' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#10': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanInitializationException: failed to initialize MessageHandler; nested exception is java.lang.IllegalArgumentException: Destination directory [./taust-ee] could not be created</code>
I have this strange problem when running Jetty 8 on Debian 8 Jessie... Don't know where to dig, apps seems to be okay, because on windows and deployed by Jenkins running well. Where can be problem?

Categories