@EnableAsync annotation metadata was not injected Spring容器启动后访问Servlet报错
@EnableAsync annotation metadata was not injected
- 7570
在初始化spring事务部分碰到该错误, 详细错误信息如下:
- 警告: Exception encountered during context initialization - cancelling refresh attempt
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method 'asyncAdvisor' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
- at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
- at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:220)
- at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
- at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
- at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
- at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
- at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
- at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
- at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
- at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
- at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
- at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
- at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
- at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
- at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
- at org.eclipse.jetty.server.Server.doStart(Server.java:282)
- at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
- at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedAdapter.start(JettyEmbeddedAdapter.java:67)
- at net.sourceforge.eclipsejetty.starter.common.AbstractJettyLauncherMain.launch(AbstractJettyLauncherMain.java:84)
- at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedLauncherMain.main(JettyEmbeddedLauncherMain.java:42)
- Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method 'asyncAdvisor' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
- at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
- ... 28 more
- Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
- at org.springframework.util.Assert.notNull(Assert.java:112)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor(ProxyAsyncConfiguration.java:45)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
EnhancerBySpringCGLIBEnhancerBySpringCGLIB
82eb591.CGLIB$asyncAdvisor$0(<generated>)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
EnhancerBySpringCGLIBEnhancerBySpringCGLIB
82eb591
FastClassBySpringCGLIBFastClassBySpringCGLIBed8c37b9.invoke(<generated>)
- at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
- at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
EnhancerBySpringCGLIBEnhancerBySpringCGLIB
82eb591.asyncAdvisor(<generated>)
- 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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
- ... 29 more
- 十二月 16, 2015 11:42:21 下午 org.springframework.web.context.ContextLoader initWebApplicationContext
- 严重: Context initialization failed
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method 'asyncAdvisor' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
- at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
- at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
- at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:220)
- at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:615)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:465)
- at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
- at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
- at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
- at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
- at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
- at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
- at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
- at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
- at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
- at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
- at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
- at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
- at org.eclipse.jetty.server.Server.doStart(Server.java:282)
- at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
- at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedAdapter.start(JettyEmbeddedAdapter.java:67)
- at net.sourceforge.eclipsejetty.starter.common.AbstractJettyLauncherMain.launch(AbstractJettyLauncherMain.java:84)
- at net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedLauncherMain.main(JettyEmbeddedLauncherMain.java:42)
- Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method 'asyncAdvisor' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
- at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
- at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
- ... 28 more
- Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
- at org.springframework.util.Assert.notNull(Assert.java:112)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor(ProxyAsyncConfiguration.java:45)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
EnhancerBySpringCGLIBEnhancerBySpringCGLIB
82eb591.CGLIB$asyncAdvisor$0(<generated>)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
EnhancerBySpringCGLIBEnhancerBySpringCGLIB
82eb591
FastClassBySpringCGLIBFastClassBySpringCGLIBed8c37b9.invoke(<generated>)
- at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
- at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
- at org.springframework.scheduling.annotation.ProxyAsyncConfiguration
EnhancerBySpringCGLIBEnhancerBySpringCGLIB
82eb591.asyncAdvisor(<generated>)
- 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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
- ... 29 more
错误原因:
在spring的配置文件applicationContext.xml中, 配置包扫描器时, 使用了*, 想扫描所有的包; 而这种方式有可能扫描到spring自带的包, 造成错误(自我理解, 不对的话求教育)
改动前:
- <!-- 包扫描器 -->
- <context:component-scan base-package="*"/>
改动后(具体指定了要扫描的包):
- <!-- 包扫描器 -->
- <context:component-scan base-package="com.git.*"/>
@EnableAsync annotation metadata was not injected Spring容器启动后访问Servlet报错的更多相关文章
- @EnableAsync annotation metadata was not injected
[问题描述] @EnableAsync annotation metadata was not injected spring配置初始化时候报错 nested exception is java.la ...
- Hive启动后show tables报错:Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
错误详情: FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive ...
- spring报nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected错误
http://www.oschina.net/question/1539472_159699
- Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
需要注意的是ComponentScan 不能扫描 org.springframework 否则会报错,要扫描指定的package才行
- spring boot, 容器启动后执行某操作
常有在spring容器启动后执行某些操作的需求,现做了一个demo的实现,做一下记录,也希望可以给需要的同学提供参考. 1.spring启动后,以新线程执行后续需要的操作,所以执行类实现Runnabl ...
- spring容器启动扩展
我们可以在spring容器启动时添加自己的定制化初始化工作. 1)具体方法为:在web.xml中配置初始化属性contextInitializerClasses的值例如: <context-pa ...
- web容器启动后自动执行程序的几种方式比较
1. 背景 1.1. 背景介绍 在web项目中我们有时会遇到这种需求,在web项目启动后需要开启线程去完成一些重要的工作,例如:往数据库中初始化一些数据,开启线程,初始化消息队 ...
- docker容器启动后添加端口映射
DOCKER 给运行中的容器添加映射端口 方法1 1.获得容器IP 将container_name 换成实际环境中的容器名 docker inspect `container_name` | grep ...
- Bug集锦-Spring Cloud Feign调用其它接口报错
问题描述 Spring Cloud Feign调用其它服务报错,错误提示如下:Failed to instantiate [java.util.List]: Specified class is an ...
随机推荐
- MIT App Inventor使用与入门教程
前言:随着信息技术新课标的提出,移动app应用设计被加入到新课标,程序与算法得到体现,学生的创造性,计算思维与信息意识也可以在其中得到体现. 安卓app开发目前比较火热的是Eclipse和Androi ...
- 论BOM管理的若干重要问题
在制造业信息化建设过程中,BOM管理的意义已经被广泛认同与重视.BOM管理是企业产品数据管理领域要解决的核心问题,对制造企业的信息流和业务流程具有重要影响,可以说企业BOM数据架构已是企业架构的一部分 ...
- STL所有算法简介 (转) http://www.cnblogs.com/yuehui/archive/2012/06/19/2554300.html
STL所有算法简介 STL中的所有算法(70个) 参考自:http://www.cppblog.com/mzty/archive/2007/03/14/19819.htmlhttp://hi.baid ...
- Zookeeper--集群管理
Zookeeper--集群管理 在多台服务器组成的集群中,需要监控每台服务器的状态,一旦某台服务器挂掉了或有新的机器加入集群,集群都要感知到,从而采取相应的措施.一个主动的集群可以自动感知节点的死亡和 ...
- 阿里云专有网络下一键安装RouterOS-ROS系统
1.阿里云环境centos6.9 x64: 内网网卡为eth0 阿里云的linux下硬盘名称为/dev/vda 注意阿里云的安全组建议开放任意协议和端口,任意IP允许访问 今天测试阿里云2C4G的死活 ...
- ping正常但是ssh到linux服务器很卡的解决方法
ssh登录很慢的问题 1.关闭ssh DNS反向解析 vi /etc/ssh/sshd_config 修改UseDNS no 2.关闭 GSSAPI 的用户认证 vi /etc/ssh/sshd ...
- Tomcat的文件列表服务
今天需要将分析后的日志结果发布到网站上供其他人浏览,虽然用户可以通过直接使用url链接可以访问到对应的文件,但是毕竟还是不方便,没有一个类似文件浏览器的东西,可以直接查看文件夹和文件列表. 其实这样的 ...
- TCP三次握手和四次挥手、HTTP协议
TCP三次握手和四次挥手 首先我们知道HTTP协议通常承载于TCP协议之上,HTTPS承载于TLS或SSL协议层之上 通过上面这张图我们能够知道. 在Http工作之前,Web浏览器通过网络和W ...
- Web页面获取用户控件页面中服务器控件的值
用户控件页面后台: public string P_Name{get { return txt_P_name.Value; }set { txt_P_name.Value = value; }} We ...
- linux下启动关闭oracle
1. linux下启动oracle su - oracle sqlplus /nolog conn /as sysdba startup exit lsnrctl start 2. linux下关闭o ...