IllegalAccessError after moving from spring boot 2.4.6 to 2.5.4 - spring

I am trying to upgrade from spring boot 2.4.6 to 2.5.4 and have started receiving following error
Error starting ApplicationContext. To display the conditions report
re-run your application with 'debug' enabled. 2021-09-28 14:10:37
[main] ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'supplierInitializer' defined in class path
resource
[org/springframework/cloud/stream/function/FunctionConfiguration.class]:
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'inMemorySwaggerResourcesProvider_integrationflow.org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0':
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'integrationGlobalProperties' defined in class
path resource
[org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.integration.context.IntegrationProperties]:
Factory method 'integrationGlobalProperties' threw exception; nested
exception is java.lang.IllegalAccessError: class
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
tried to access private method 'void
org.springframework.integration.context.IntegrationProperties.()'
(org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
and org.springframework.integration.context.IntegrationProperties are
in unnamed module of loader 'app')
Not able to understand what has changed in spring boot 2.5.X , although upgrading till version 2.4.11 works fine.

I guess you have an old version of spring-integration-core library. Delete all the folders under .m2/repository/org/springframework/integration That should fix it.

Related

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

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource

I'm unable to run springboot application because of below error.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax/validation/ParameterNameProvider;
Please help me.
This looks like an error caused by an illegal mix of spring versions.
Try to run mvn dependency:tree and see whether there are different versions of spring mixed in the classpath.

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

Unable to use MicroMeter instead Of Prometheus

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]

HTTP ERROR 503 with Spring Framework

I am using appEngine with Spring Framework and maven. I run the application from maven and everything is fine in command line but in browser I found this error.
HTTP ERROR: 503
Problem accessing /. Reason:
SERVICE_UNAVAILABLE
I don't know where I have to fix. Below is the error code in terminal when I try to run with maven. I think Spring framework has big problem in my PC.
[INFO] WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#0': Cannot create inner bean '(inner bean)' of type [org.springframework.web.servlet.handler.ConversionServiceExposingInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'org.springframework.format.support.FormattingConversionServiceFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.format.support.FormattingConversionServiceFactoryBean#0': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: java.time.format.FormatStyle is a restricted class. Please see the Google App Engine developer's guide for more details.:
[INFO] java.lang.NoClassDefFoundError: java.time.format.FormatStyle is a restricted class. Please see the Google App Engine developer's guide for more details.

Categories

Resources