Skip to content

WildFly deployment with Spring Security generates WARNING on startup #11891

@rwinch

Description

@rwinch

This was originally reported at spring-projects/spring-security#4989

When spring-boot-starter-security is on the classpath of a WildFly application it produces the following warning at startup:

22:35:30,807 WARN  [org.jboss.modules] (ServerService Thread Pool -- 64) Failed to define class org.springframework.security.web.reactive.result.method.annotation.AuthenticationPrincipalArgumentResolver in Module "deployment.demo.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/springframework/security/web/reactive/result/method/annotation/AuthenticationPrincipalArgumentResolver (Module "deployment.demo.war:main" from Service Module Loader): org/springframework/web/reactive/result/method/HandlerMethodArgumentResolverSupport
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
	at org.jboss.modules.Module.loadModuleClass(Module.java:606)
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$MatchType.forName(OnClassCondition.java:234)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$MatchType.isPresent(OnClassCondition.java:223)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$MatchType.access$300(OnClassCondition.java:198)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$MatchType$2.matches(OnClassCondition.java:213)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition.getMatches(OnClassCondition.java:181)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition.access$400(OnClassCondition.java:52)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$StandardOutcomesResolver.getOutcome(OnClassCondition.java:318)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$StandardOutcomesResolver.getOutcomes(OnClassCondition.java:310)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition$StandardOutcomesResolver.resolveOutcomes(OnClassCondition.java:298)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition.getOutcomes(OnClassCondition.java:99)
	at org.springframework.boot.autoconfigure.condition.OnClassCondition.match(OnClassCondition.java:63)
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.filter(AutoConfigurationImportSelector.java:243)
	at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:101)
	at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:547)
	at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:138)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
	at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:155)
	at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:135)
	at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)
	at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172)
	at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:186)
	at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)
	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
	at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
	at org.jboss.threads.JBossThread.run(JBossThread.java:320)

The WARNING is logged because Spring Boot ReactiveSecurityAutoConfiguration is conditional on AuthenticationPrincipalArgumentResolver being present. When Boot attempts to load the class to see if it is present and determine if ReactiveSecurityAutoConfiguration should be loaded it fails because org/springframework/web/reactive/result/method/HandlerMethodArgumentResolverSupport is not on the classpath. When JBoss modules finds AuthenticationPrincipalArgumentResolver and does not find org/springframework/web/reactive/result/method/HandlerMethodArgumentResolverSupport it logs this warning message.

To avoid the warning we could change the conditional to include a conditional on Spring WebFlux being on the classpath before we check to see if Spring Security WebFlux is present.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions