Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.15.0
Description
The issue was introduced by GEODE-10282. As part of commit 41305de1405c2125142e6b337c3f1704f736fca4, SwaggerConfig classes used to start and configure the internal geode-web-management and geode-web-api services use the @SpringBootApplication annotation. This annotation automatically enables other spring annotations (like @EnableAutoConfiguration and @ComponentScan) which, in turn, might cause critical issues during startup as spring tries to automatically configure several services based on classes and interfaces found within the member's class path.
—
I'm attaching a small scenario that reproduces the problem; the reproduce.sh script simply starts a locator making sure that the spring-jdbc-5.3.20.jar is part of the class path. When using any commit after 41305de1405c2125142e6b337c3f1704f736fca4 the logs will contain the following:
[info 2022/05/16 15:54:38.997 IST locator0 <main> tid=0x1] Adding webapp /management [info 2022/05/16 15:54:39.610 IST locator0 <main> tid=0x1] Initializing Servlet 'management' [info 2022/05/16 15:54:42.124 IST locator0 <main> tid=0x1] Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@33ed6546, org.springframework.security.web.context.SecurityContextPersistenceFilter@5a503cf0, org.springframework.security.web.header.HeaderWriterFilter@5b04224a, org.springframework.security.web.authentication.logout.LogoutFilter@17db90a7, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6f78c132, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@42f9b425, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@54d62c35, org.springframework.security.web.session.SessionManagementFilter@78907a46, org.springframework.security.web.access.ExceptionTranslationFilter@eaf3dd0, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@7cd6b76a] [warn 2022/05/16 15:54:42.975 IST locator0 <main> tid=0x1] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Unsatisfied dependency expressed through method 'dataSource' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException [error 2022/05/16 15:54:42.980 IST locator0 <main> tid=0x1] Context initialization failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Unsatisfied dependency expressed through method 'dataSource' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170) at javax.servlet.GenericServlet.init(GenericServlet.java:244) at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:632) at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:415) at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:731) at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:313) at java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:743) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:755) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379) at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916) at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) at org.apache.geode.internal.cache.http.service.InternalHttpService.addWebApplication(InternalHttpService.java:212) at org.apache.geode.distributed.internal.InternalLocator.lambda$startClusterManagementService$3(InternalLocator.java:842) at java.util.Optional.ifPresent(Optional.java:159) at org.apache.geode.distributed.internal.InternalLocator.startClusterManagementService(InternalLocator.java:829) at org.apache.geode.distributed.internal.InternalLocator.startClusterManagementService(InternalLocator.java:795) at org.apache.geode.distributed.internal.InternalLocator.startCache(InternalLocator.java:788) at org.apache.geode.distributed.internal.InternalLocator.startDistributedSystem(InternalLocator.java:769) at org.apache.geode.distributed.internal.InternalLocator.startLocator(InternalLocator.java:400) at org.apache.geode.distributed.LocatorLauncher.start(LocatorLauncher.java:779) at org.apache.geode.distributed.LocatorLauncher.run(LocatorLauncher.java:685) at org.apache.geode.distributed.LocatorLauncher.main(LocatorLauncher.java:222) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887) at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791) ... 47 more Caused by: java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.afterPropertiesSet(DataSourceProperties.java:183) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ... 58 more Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataAccessException at java.net.URLClassLoader.findClass(URLClassLoader.java:387) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:538) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 61 more
If you execute a reverse apply of commit 41305de1405c2125142e6b337c3f1704f736fca4 to undo the changes (git show 41305de1405c2125142e6b337c3f1704f736fca4 | git apply -R), re-build geode and execute the test again, logs won't contain any errors as there's nothing trying to automatically configure a data-source:
[info 2022/05/16 15:59:44.224 IST locator0 <main> tid=0x1] Adding webapp /management [info 2022/05/16 15:59:45.293 IST locator0 <main> tid=0x1] Initializing Servlet 'management' ... [info 2022/05/16 15:59:48.259 IST locator0 <main> tid=0x1] Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@b7b26c6, org.springframework.security.web.context.SecurityContextPersistenceFilter@39336f5, org.springframework.security.web.header.HeaderWriterFilter@3db48e6, org.springframework.security.web.authentication.logout.LogoutFilter@1adc38a0, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@cbd9494, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@4ac1544f, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@2db07651, org.springframework.security.web.session.SessionManagementFilter@31c17fd4, org.springframework.security.web.access.ExceptionTranslationFilter@3e60be48, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@118cbb26] [info 2022/05/16 15:59:48.320 IST locator0 <main> tid=0x1] Context refreshed
Attachments
Attachments
Issue Links
- is caused by
-
GEODE-10282 Migrate from springfox to springdoc
- Closed
- links to