Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not initialize JfrConnectionCreatedEvent #1767

Closed
Alfagun74 opened this issue Jun 7, 2021 · 24 comments
Closed

Could not initialize JfrConnectionCreatedEvent #1767

Alfagun74 opened this issue Jun 7, 2021 · 24 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@Alfagun74
Copy link

Bug Report

Current Behavior

Since the latest Spring 2.5.0 Update we observe a Lettuce/Redis Error on every single Request, which basically breaks our App. It is in the Stacktrace below.

We use the default Property based Autoconfiguration. Spring 2.4.5 worked perfectly fine. Has something changed that i am not aware of?

Stack trace
Unhandled Exception in Controller, returning: HTTP 500 INTERNAL_SERVER_ERROR
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class io.lettuce.core.event.connection.JfrConnectionCreatedEvent

Expected behavior/code

It should work fine like it did with Spring 2.4.5.

Environment

  • spring-boot-starter-data-redis: 2.5.0

Any help/hint is greatly appreciated

@Alfagun74 Alfagun74 changed the title Could not initialize JfrConnectionCreatedEvent with Spring 2.5.0 Updata Could not initialize JfrConnectionCreatedEvent with Spring 2.5.0 Update Jun 7, 2021
@mp911de
Copy link
Collaborator

mp911de commented Jun 7, 2021

Can you attach the full stack trace of Could not initialize class io.lettuce.core.event.connection.JfrConnectionCreatedEvent? What JVM version ($ java -version) are you using?

Lettuce should not attempt loading JFR classes unless your JVM version ships with JFR support.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Jun 7, 2021
@Alfagun74
Copy link
Author

Alfagun74 commented Jun 7, 2021

This is the full Stack Trace:

Unhandled Exception in Controller, returning: HTTP 500 INTERNAL_SERVER_ERROR

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class io.lettuce.core.event.connection.JfrConnectionCreatedEvent

            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1078)

            at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)

            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)

            at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:626)

            at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:113)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)

            at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121)

            at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)

            at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:149)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)

            at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)

            at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110)

            at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)

            at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)

            at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)

            at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358)

            at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)

            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.cloudfoundry.router.ClientCertificateMapper.doFilter(ClientCertificateMapper.java:79)

            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)

            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)

            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)

            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)

            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)

            at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:764)

            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)

            at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)

            at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

            at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)

            at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)

            at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

            at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

            at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

            at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

            at java.base/java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.lettuce.core.event.connection.JfrConnectionCreatedEvent

            at jdk.internal.reflect.GeneratedConstructorAccessor87.newInstance(Unknown Source)

            at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

            at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)

            at io.lettuce.core.event.jfr.JfrEventRecorder.createEvent(JfrEventRecorder.java:108)

            at io.lettuce.core.event.jfr.JfrEventRecorder.record(JfrEventRecorder.java:48)

            at io.lettuce.core.AbstractRedisClient.initializeChannelAsync(AbstractRedisClient.java:376)

            at io.lettuce.core.RedisClient.connectStatefulAsync(RedisClient.java:325)

            at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:287)

            at io.lettuce.core.RedisClient.connect(RedisClient.java:216)

            at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115)

            at java.base/java.util.Optional.orElseGet(Unknown Source)

            at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115)

            at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1527)

            at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1315)

            at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1298)

            at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1039)

            at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:371)

            at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:193)

            at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:144)

            at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:105)

            at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:209)

            at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:189)

            at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:176)

            at org.springframework.data.redis.core.RedisKeyValueAdapter.get(RedisKeyValueAdapter.java:310)

            at org.springframework.data.keyvalue.core.KeyValueTemplate.lambda$findById$3(KeyValueTemplate.java:269)

            at org.springframework.data.keyvalue.core.KeyValueTemplate.execute(KeyValueTemplate.java:362)

            at org.springframework.data.keyvalue.core.KeyValueTemplate.findById(KeyValueTemplate.java:267)

            at org.springframework.data.keyvalue.repository.support.SimpleKeyValueRepository.findById(SimpleKeyValueRepository.java:110)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

            at java.base/java.lang.reflect.Method.invoke(Unknown Source)

            at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:289)

            at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:137)

            at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:121)

            at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:529)

            at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)

            at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:599)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

            at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:163)

            at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:138)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

            at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)

            at com.sun.proxy.$Proxy167.findById(Unknown Source)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

            at java.base/java.lang.reflect.Method.invoke(Unknown Source)

            at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

            at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)

            at com.sun.proxy.$Proxy167.findById(Unknown Source)

            at java.base/java.util.Optional.map(Unknown Source)

            at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)

            at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)

            at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

            at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

            at java.base/java.lang.reflect.Method.invoke(Unknown Source)

            at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)

            at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)

            at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)

            at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

            at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)

            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)

            at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)

            at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

            at java.base/java.lang.reflect.Method.invoke(Unknown Source)

            at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)

            at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)

            at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)

            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:894)

            at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)

            at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

            at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1063)

            ... 91 common frames omitted

There is also a second Error which fires periodically:

Scheduler worker in group main failed with an uncaught exception

java.lang.NoClassDefFoundError: Could not initialize class io.lettuce.core.event.connection.JfrConnectionCreatedEvent

                at jdk.internal.reflect.GeneratedConstructorAccessor87.newInstance(Unknown Source)

                at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

                at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)

                at io.lettuce.core.event.jfr.JfrEventRecorder.createEvent(JfrEventRecorder.java:108)

                at io.lettuce.core.event.jfr.JfrEventRecorder.record(JfrEventRecorder.java:48)

                at io.lettuce.core.AbstractRedisClient.initializeChannelAsync(AbstractRedisClient.java:376)

                at io.lettuce.core.RedisClient.connectStatefulAsync(RedisClient.java:325)

                at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:287)

                at io.lettuce.core.RedisClient.connect(RedisClient.java:216)

                at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115)

                at java.base/java.util.Optional.orElseGet(Unknown Source)

                at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115)

                at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1527)

                at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1315)

                at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1298)

                at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedReactiveConnection(LettuceConnectionFactory.java:1049)

                at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:461)

                at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:101)

                at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:85)

                at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:227)

                at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)

                at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)

                at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

                at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)

                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                at java.base/java.lang.Thread.run(Unknown Source)

Need a Minute to check the JVM Version we use in our container. But i do know we use Java 11 if thats enough.

EDIT: Redacted some lines retrospectively for security reasons

@PhilippAllstadt
Copy link

I am a team member of alfagun and we use open-jdk 11.0.10 as buildpack

@mp911de
Copy link
Collaborator

mp911de commented Jun 7, 2021

This looks as if there was a dependency conflict. JfrEventRecorder was introduced with Lettuce 6.1, and the same version ships JfrConnectionCreatedEvent. Can you spot earlier occurrences of JfrConnectionCreatedEvent?

Right now, there's no way to disable JFR event publishing unless using an older Java 8 runtime. I wonder whether it would make sense to add a config flag (system property) to disable JFR by configuration.

@PhilippAllstadt
Copy link

Sadly, there are no occurrences of JfrConnectionCreatedEvent in other dependencies or elsewhere only in Lettuce as i could see. So do you mean there is no configuration yet to disable JFR via system properties or elsewhere ? Maybe we have to switch back to Java 8 runtime for the moment.

@mp911de
Copy link
Collaborator

mp911de commented Jun 8, 2021

Likely rolling back to Lettuce 6.0.x comes with the least impact. For a Java 8 rollback, you'd need to roll back to a version earlier than JDK 8 update 262 which can impose security concerns.

@Alfagun74
Copy link
Author

Alfagun74 commented Jun 8, 2021

I just double checked, we only have "lettuce-core 6.1.2.RELEASE" imported by Spring-Data-Redis in our Project.
We're going to stay at Java 11 and exclude it manually and import a 6.0.X version for now.
Thank you for your fast and good help so far @mp911de. Do you know what may cause this Error in 6.1.2?

@Alfagun74
Copy link
Author

With manual downgrade to 6.0.4 it works for now

@mp911de
Copy link
Collaborator

mp911de commented Jun 8, 2021

Without additional details, I cannot really tell what causes the problem. I haven't seen such issues in other integrations (e.g. when building Spring Data Redis or Spring Data Redis examples on Java 16).

@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 8, 2021
@mp911de mp911de changed the title Could not initialize JfrConnectionCreatedEvent with Spring 2.5.0 Update Could not initialize JfrConnectionCreatedEvent Jun 8, 2021
@mp911de mp911de added this to the 6.1.3 milestone Jun 8, 2021
@mp911de
Copy link
Collaborator

mp911de commented Jun 9, 2021

I introduced a system property to disable JFR support. I'd like actually to dig further here to find out about the cause. Can you update your application to perform some Redis interaction right at the startup of your application? Moving the interaction phase to the startup would give us an opportunity to have improved means of logging instead of relying on the web request logging.

@PhilippAllstadt
Copy link

Thank you very much for the support, we will include the updated version and try out the new flag. So we could try to interact via crud repository right due to the startup phase of the app.

@mp911de mp911de closed this as completed Jun 21, 2021
@Alfagun74
Copy link
Author

Hi @mp911de I cant seem to set the property. How & where do you set it the correct way? It doesn't get recognized in my Application YAML and also wont be recognized when we set it in PostConstruct in our Spring App.

@mp911de
Copy link
Collaborator

mp911de commented Jun 24, 2021

The property is a system property. Spring Boot's application properties are not system properties. If you do not have access to system properties I suggest setting the system property in your main method before invoking SpringApplication.run(…).

@Alfagun74
Copy link
Author

Tysm! @mp911de

@thesoundofsilent
Copy link

@Alfagun74 Use the same code but fail to reproduce your issue, is there any other setting to reproduce the same error?

@tawAsh1
Copy link
Contributor

tawAsh1 commented Sep 9, 2021

I'm still investigating, but it is possible that this error occurs when running on OpenJ9 JVM environment where jdk.jfr.Event can be loaded.

@vishnuprakash-thoughtworks-sde
Copy link

hi @Alfagun74 @mp911de do we know the root cause for this issue. we are also facing the same issue in our spring boot app (version 2.5.0). For us the issue is happening when App Dynamics agent is enabled.

@mp911de
Copy link
Collaborator

mp911de commented Dec 14, 2021

For us the issue is happening when App Dynamics agent is enabled.

You might want to reach out to the App Dynamics folks and let them help you with investigating what's going on.

I wasn't able to reproduce the issue at all.

@vishnuprakash-thoughtworks-sde

thanks for the reply @mp911de . what is the impact of disabling JFR events in lettuce?

@armanaaquib
Copy link

Hello @vishnu-kprakash , Could you please tell how did you solve the problem? We are also getting the same error after enabling App Dynamics agent.

@vishnuprakash-thoughtworks-sde

We took help from app dymanics team, they have made some changes in the agent configuration which resolved the issue

@brettalcox
Copy link

@vishnu-kprakash can you provide any detail on what the agent configuration changes were? was it agent config provided by the user? or bundled into a new version of the agent itself?

@brettalcox
Copy link

For visibility, adding --add-reads=jdk.jfr=ALL-UNNAMED to your JVM args will resolve the issue. TBD if this is something that needs to be permanent or addressed in future agent release.

@EvertonSA
Copy link

as matter of documentation, follow what --add-reads=jdk.jfr=ALL-UNNAMED does:

Flight Recorder collects data as events. An event has a time stamp, duration and usually an application-specific payload, useful for diagnosing the running application up to the failure or crash.

The compiler and runtime option --add-reads $module=$targets adds readability edges from $module to all modules in the comma-separated list $targets. This allows $module to access all public types in packages exported by those modules even though $module has no requires clauses mentioning them. If $targets is set to ALL-UNNAMED, $module can even read the unnamed module.

https://docs.oracle.com/en/java/javase/11/docs/api/jdk.jfr/jdk/jfr/package-summary.html
https://nipafx.dev/five-command-line-options-hack-java-module-system/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

9 participants