Unable to use MicroMeter instead Of Prometheus - spring-boot

I upgraded my Spring Version from 1.5 to 2.0 and upgraded Prometheus version 0.3.0 to 0.6.0. But unfortunately, it was not working. I was told I have to use MicroMeter instead of SimpleClient and added io.micrometer to my pom.xml and #EnablePrometheusEndpointremoved for my MetricConfig class but I come across with following error. Do you know why I get such kind of error ?
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'servletEndpointRegistrar' defined in
class path resource
[org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]:
Factory method 'servletEndpointRegistrar' threw exception; nested
exception is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'routeControllerEndpoint' defined in
class path resource
[org/apache/camel/spring/boot/actuate/endpoint/CamelRouteControllerEndpointAutoConfiguration.class]:
Unsatisfied dependency expressed through method
'routeControllerEndpoint' parameter 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'camelContext' defined in class path resource
[org/apache/camel/spring/boot/CamelAutoConfiguration.class]:
Post-processing of merged bean definition failed; nested exception is
java.lang.IllegalStateException: Failed to introspect Class
[org.apache.camel.impl.DefaultCamelContext] from ClassLoader
[jdk.internal.loader.ClassLoaders$AppClassLoader#77556fd]

Related

Why my spring boot app couldn't access service of the redis node provided by sentinel but that redis node is actually healthy

Platform: Windows 10
JDK: 11
Command to start redis and sentinel:
cd PATH_TO_REDIS\redis_s6379
redis-server.exe redis.windows.conf
redis-server.exe sentinel.conf --sentinel
Redis client: jedis
Detailed log
partial log
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.micrometer.spring.web.servlet.WebMvcMetricsFilter]: Factory method 'webMetricsFilter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'endpointHandlerMapping' defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerMapping]: Factory method 'endpointHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcEndpoints' defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthMvcEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcManagementContextConfiguration.class]: Unsatisfied dependency expressed through method 'healthMvcEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$$EnhancerBySpringCGLIB$$700f4ba6]: Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$RedisHealthIndicatorConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jedisConnectionFactory' defined in class path resource [com/corp_name/corp_config/RedisConfig.class]: Invocation of init method failed; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: All sentinels down, cannot determine where is mymaster master is running...
The solution for this one is to make sure your sentinel.conf file have the right config.
Add 127.0.0.1 redis-server in your host file. Use "redis-server" as the host value of redis for both the configurations of file("redis.windows.conf") and file("sentinel.conf").
The above solution is inferred from reading the source code file("Connection.java").
redis/clients/jedis/Connection.java:184
Some prerequisite:
windows doesn't support ping the host itself using ipv4 address but mac does.

Install reportportal on kube get error : starting Tomcat context. Exception: org...message: Error creating bean with name 'servletEndpointRegistrar'

I've installed reportportal 5.7.0 to kubernetes cluster. I've implemented it from doc:https://github.com/reportportal/kubernetes/tree/develop/reportportal. From the doc,I have to install rabbitmq, postgres and minio for reportportal. I've successfully installed abbitmq, postgres and minio. All pods were running but when I've installed reportportal. Report-portal-api pods was error. I've get logs form the pods then the pods logs shown that
o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat
context. Exception: org.springframework
.beans.factory.BeanCreationException. Message: Error creating bean
with name 'servletEndpointRegistrar' defined in class path resource
[org/springframework/bo
ot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]:
Bean instantia tion via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.springframework.boot.actu
ate.endpoint.web.ServletEndpointRegistrar]: Factory method
'servletEndpointRegistrar' threw exception; nested exception is
org.springframework.beans.factory.B eanCreationException: Error
creating bean with name 'infoEndpoint' defined in class path resource
[org/springframework/boot/actuate/autoconfigure/info/InfoEnd
pointAutoConfiguration.class]: Bean instantiation via factory method
failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [org.springframework.boot.actuate.info.InfoEndpoint]:
Factory method 'infoEndpoint' threw exception; nested exception is
org.springframework.be ans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'infoContributorComposite' defined in
URL [jar:file:/service-api-5.7.0-exec.jar!/BOO
T-INF/classes!/com/epam/ta/reportportal/info/InfoContributorComposite.class]:
Unsatisfied dependency expressed through constructor parameter 0;
nested excepti on is
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'analyzerInfoContributor' defined in URL
[jar:file:/serv
ice-api-5.7.0-exec.jar!/BOOT-INF/classes!/com/epam/ta/reportportal/info/AnalyzerInfoContributor.class]:
Unsatisfied dependency expressed through constructor p arameter 0;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'managementTemplate' defined in class p ath
resource
[com/epam/ta/reportportal/core/configs/rabbit/AnalyzerRabbitMqConfiguration.class]:
Bean instantiation via factory method failed; nested exceptio n is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[com.epam.ta.reportportal.core.analyzer.auto.client.RabbitMqManagementClient]
: Factory method 'managementTemplate' threw exception; nested
exception is com.epam.ta.reportportal.exception.ReportPortalException:
Unclassified Report Porta l Error
I suspected that reportportal connect to rabbitmq was error but I'm not sure. What should I do?
That's true. Double-check your rabbitmq configuration: connection URL, open ports, etc. We have a step-by-step guide on Kubernetes deployment: https://github.com/reportportal/kubernetes/tree/develop/reportportal

Cassandra-3.7 connection from Spring boot 2.1.2/2.1.6

We have an application developed in spring boot and we do use cassandra.
Our application was suing spring boot 1.4, cassandra 3.7 and JDK 1.8
Now we are tryign to upgrade spring boot to 2.1.2/2.1.6 and JDK 1.8 to Open JDK 11.0.2 and cassandra is as : 3.7
So when we are trying, we are recieving the
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed.
(com.datastax.driver.core.exceptions.TransportException: [HOSTS] Error writing)
Not sure what is going wrong.
Couple of pointers is:
1) Application is running fine on local on eclipse and this is issue when we are trying to start the application in server
Here is the stacktrace I see:
WARN 10473 --- [ main] org.eclipse.jetty.webapp.WebAppContext : Failed startup of context o.s.b.w.e.j.JettyEmbeddedWebAppContext#75a118e6{application,/console,[org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory$LoaderHidingResource#1d540566],UNAVAILABLE}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 1;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthIndicatorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicatorRegistry]: Factory method 'healthIndicatorRegistry' threw exception;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.cassandra.CassandraHealthIndicatorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cassandraTemplate' defined in class path resource [CassandraDatabaseConfig.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.core.CassandraAdminTemplate]: Factory method 'cassandraTemplate' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [CassandraDatabaseConfig.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.cassandra.SessionFactory]: Factory method 'sessionFactory' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'session' defined in class path resource [CassandraDatabaseConfig.class]: Invocation of init method failed;
nested exception is com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: host1:port1 (com.datastax.driver.core.exceptions.TransportException: [host1:port1] Error writing))
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627)
Please let me know if any more additional details needed.
Tried to changed version of Cassandra driver version, explicilty trying to logging to Cassandra
This is our CassandraConfig class where we create the cluster object.
CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean();
cluster.setContactPoints(contactPoints);
cluster.setPort(Integer.valueOf(port));
cluster.setUsername(userName);
cluster.setPassword(password);
return cluster;
Server should start by connecting to cassandra

org.springframework.beans.factory.UnsatisfiedDependencyException:oracle driver not found

I am using SPRING BOOT ORACLE JPA with GRADLE a simple project but while running I am getting:
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name
'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'dataSource' defined in class path resource
[org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method
'dataSource' threw exception; nested exception is
java.lang.IllegalStateException: Cannot load driver class:
oracle.jdbc.driver.OracleDriver
My application.properties are:
server.port=8082 # create n drop tables, loads import.sql
spring.jpa.hibernate.ddl-auto=create-drop
spring.datasource.url=jdbc:oracle:thin:#//138.69.14.63:1521/drbadev
spring.datasource.username=$$$$$$$$$$ spring.datasource.password=$$$$$$
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
What can I do to solve this?

Weird ClassNotFoundException in WebLogic 10.3.6

We have an .ear file that is running normal in a WebLogic 10.3.6 application server.
The .ear uses Spring 3.0.5 and Hibernate 3.5.2.
If we deploy the same .ear file in another WebLogic 10.3.6 server, we get the next error.
org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterService': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private nl.surf.adapter.generic.dao.MessageFilterDAO nl.surf.adapter.generic.service.FilterService.messageFilterDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private nl.surf.adapter.generic.dao.MessageFilterDAO nl.surf.adapter.generic.service.FilterService.messageFilterDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/domain-config.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError
Caused by: java.lang.NoClassDefFoundError
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
I've tried several solutions:
Place hibernate3.jar in .war/WEB-INF/lib (all jars are now in .ear/lib)
Use <prefer-web-inf-classes>true</prefer-web-inf-classes> in .war/WEB-INF/weblogic.xml
Nothing seems to work.
I'm kind of lost here...
After some extensive searching on the web and trial and error changes on the .ear, i've found the solution for my problem.
I've changed file META-INF/weblogic-application.xml and added the tags beneath inside tag <weblogic-application>
<prefer-application-packages>
<package-name>org.apache.*</package-name>
<package-name>antlr.*</package-name>
</prefer-application-packages>

Resources