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

fix detection of FilterChainProxy bean presence… #549

Closed
wants to merge 1 commit into from

Conversation

bkoehm
Copy link

@bkoehm bkoehm commented Nov 20, 2024

…such that a NoSuchBeanDefinitionException isn't thrown if the class resolves but the bean doesn't exist

…nDefinitionException isn't thrown if the class resolves but the bean doesn't exist
@codeconsole
Copy link
Contributor

@bkoehm I can't replicate the problem

https://github.com/codeconsole/demo-622-to-7

I don't understand why you have FilterChainProxy in your class path, but don't have a filterChain?

@bkoehm
Copy link
Author

bkoehm commented Nov 22, 2024

@codeconsole I'm encountering it in a unit test that implements grails.testing.web.taglib.TagLibUnitTest from grails-web-testing-support. The unit test calls applyTemplate(). This unit test runs within a project that has spring-security as a dependency.

@bkoehm
Copy link
Author

bkoehm commented Nov 22, 2024

Relevant part of a stacktrace of failing test:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.plugins.web.taglib.FormTagLib': No qualifying bean of type 'org.springframework.security.web.FilterChainProxy' available
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1802)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1272)
	at org.grails.taglib.TagLibraryLookup.putTagLib(TagLibraryLookup.java:141)
	at org.grails.testing.runtime.support.LazyTagLibraryLookup.putTagLib(LazyTagLibraryLookup.java:105)
	at org.grails.taglib.TagLibraryLookup.registerTagLib(TagLibraryLookup.java:113)
	at org.grails.taglib.TagLibraryLookup.registerTagLib(TagLibraryLookup.java:92)
	at org.grails.testing.runtime.support.LazyTagLibraryLookup.lookupTagLibrary(LazyTagLibraryLookup.java:91)
	at grails.artefact.gsp.TagLibraryInvoker$Trait$Helper.methodMissing(TagLibraryInvoker.groovy:80)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at edu.berkeley.ui.BootstrapExtrasTagLib.methodMissing(BootstrapExtrasTagLib.groovy)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
	at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:924)
	at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1413)
	at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1335)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:645)
	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:628)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:391)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:328)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at edu.berkeley.ui.BootstrapExtrasTagLib$_closure1.doCall(BootstrapExtrasTagLib.groovy:37)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:279)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
	at groovy.lang.Closure.call(Closure.java:433)
	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:446)
	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:364)
	... 64 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.security.web.FilterChainProxy' available
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:373)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:364)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1290)
	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
	at org.grails.plugins.web.taglib.FormTagLib.afterPropertiesSet(FormTagLib.groovy:81)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1849)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1798)
	... 107 more

@codeconsole
Copy link
Contributor

ok, well if that is the case, I would prefer to just ignore the exception. Does this work for you?
#550

@bkoehm
Copy link
Author

bkoehm commented Nov 22, 2024

Yep, works for me.

@bkoehm bkoehm closed this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants