java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • If @ComponentScan is used as a meta annotation and filters are attributes that can be overriden via the target annotation, the following happens: {noformat} java.lang.IllegalArgumentException: Attribute 'excludeFilters' is of type [Filter[]], but [AnnotationAttributes[]] was expected. Cause: at org.springframework.core.annotation.AnnotationAttributes.doGet(AnnotationAttributes.java:117) at org.springframework.core.annotation.AnnotationAttributes.getAnnotationArray(AnnotationAttributes.java:101) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:103) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:249) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:155) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) {noformat} When the filters are uses like so, in the meta-annotation, it works well: {code:java} @ComponentScan( excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = TestConfiguration.class) } ) @Import(PostProcessors.class) @EnableWebMvc @Configuration @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface WebContextConfiguration { } {code} This however, breaks: {code:java} @ComponentScan @Import(PostProcessors.class) @EnableWebMvc @Configuration @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface WebContextConfiguration { Filter[] excludeFilters() default {}; } @WebContextConfiguration( excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = TestConfiguration.class) } ) public class Config {} {code}
    via by Maciej Drozdzowski,
  • If @ComponentScan is used as a meta annotation and filters are attributes that can be overriden via the target annotation, the following happens: {noformat} java.lang.IllegalArgumentException: Attribute 'excludeFilters' is of type [Filter[]], but [AnnotationAttributes[]] was expected. Cause: at org.springframework.core.annotation.AnnotationAttributes.doGet(AnnotationAttributes.java:117) at org.springframework.core.annotation.AnnotationAttributes.getAnnotationArray(AnnotationAttributes.java:101) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:103) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:249) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:155) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) {noformat} When the filters are uses like so, in the meta-annotation, it works well: {code:java} @ComponentScan( excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = TestConfiguration.class) } ) @Import(PostProcessors.class) @EnableWebMvc @Configuration @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface WebContextConfiguration { } {code} This however, breaks: {code:java} @ComponentScan @Import(PostProcessors.class) @EnableWebMvc @Configuration @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface WebContextConfiguration { Filter[] excludeFilters() default {}; } @WebContextConfiguration( excludeFilters = { @ComponentScan.Filter(type = FilterType.ANNOTATION, value = TestConfiguration.class) } ) public class Config {} {code}
    via by Maciej Drozdzowski,
  • What's wrong with RabbitMQ in Spring Boot
    via by Unknown author,
  • I'm trying to create a _composed annotation_ which uses {{@Configuration}} and {{@ComponentScan}} as meta-annotations. {code} @Configuration @ComponentScan @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface BennuSpringModule { String[] basePackages() default {}; String[] bundles() default {}; } {code} The problem appears in {{ConfigurationClassPostProcessor}}: {noformat} java.lang.IllegalArgumentException: Attribute 'nameGenerator' is of type [String], but [Class] was expected. Cause: at org.springframework.core.annotation.AnnotationAttributes.doGet(AnnotationAttributes.java:117) at org.springframework.core.annotation.AnnotationAttributes.getClass(AnnotationAttributes.java:89) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:82) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:236) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:173) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:241) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:182) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:152) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:299) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:530) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) at javax.servlet.GenericServlet.init(GenericServlet.java:160) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1091) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) {noformat} The meta-annotation is being processed with {{classValuesAsString}} set to {{true}} which breaks the look-up for Class Type. See [AnnotationAttributesReadingVisitor|https://github.com/spring-projects/spring-framework/blob/161819f1417579c915751a6ef1fa7699963574fb/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java#L282] for details.
    via by Sérgio Silva,
  • I'm trying to create a _composed annotation_ which uses {{@Configuration}} and {{@ComponentScan}} as meta-annotations. {code} @Configuration @ComponentScan @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface BennuSpringModule { String[] basePackages() default {}; String[] bundles() default {}; } {code} The problem appears in {{ConfigurationClassPostProcessor}}: {noformat} java.lang.IllegalArgumentException: Attribute 'nameGenerator' is of type [String], but [Class] was expected. Cause: at org.springframework.core.annotation.AnnotationAttributes.doGet(AnnotationAttributes.java:117) at org.springframework.core.annotation.AnnotationAttributes.getClass(AnnotationAttributes.java:89) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:82) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:236) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:173) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:241) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:182) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:152) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:299) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:658) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:530) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:484) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) at javax.servlet.GenericServlet.init(GenericServlet.java:160) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1091) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) {noformat} The meta-annotation is being processed with {{classValuesAsString}} set to {{true}} which breaks the look-up for Class Type. See [AnnotationAttributesReadingVisitor|https://github.com/spring-projects/spring-framework/blob/161819f1417579c915751a6ef1fa7699963574fb/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java#L282] for details.
    via by Sérgio Silva,
    • java.lang.IllegalArgumentException: Attribute 'excludeFilters' is of type [Filter[]], but [AnnotationAttributes[]] was expected. Cause: at org.springframework.core.annotation.AnnotationAttributes.doGet(AnnotationAttributes.java:117) at org.springframework.core.annotation.AnnotationAttributes.getAnnotationArray(AnnotationAttributes.java:101) at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:103) at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:249) at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:218) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185) at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:155) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:609) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1270) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

    Users with the same issue

    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,