zoukankan      html  css  js  c++  java
  • applicaitonContext属性未注入, 请在applicationContext.xml中定义SpringContextHolder.

    我用的jeesite框架,在使用定时任务时,出现一些问题,,
    1.在windows上项目可以在tomcat下,运行
    2.在linux下项目在tomcatgh下,却出现问题:

    15-Dec-2017 15:15:37.552 INFO [www.toolcoo.com-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
    2017-12-15 15:15:44,224 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tasksBean': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.chseeker.modules.information.service.ToolInformationService com.thinkgem.jeesite.modules.sys.init.TasksBean.informationService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'toolInformationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.chseeker.modules.use.service.ToolUserInfoService com.chseeker.modules.information.service.ToolInformationService.toolUserInfoService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'toolUserInfoService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected com.thinkgem.jeesite.common.persistence.CrudDao com.thinkgem.jeesite.common.service.CrudService.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'toolUserInfoDao': FactoryBean threw exception on object creation; nested exception is …………
    Caused by: java.lang.IllegalStateException: applicaitonContext属性未注入, 请在applicationContext.xml中定义SpringContextHolder.
    at org.apache.commons.lang3.Validate.validState(Validate.java:826)
    at com.thinkgem.jeesite.common.utils.SpringContextHolder.assertContextInjected(SpringContextHolder.java:105)
    at com.thinkgem.jeesite.common.utils.SpringContextHolder.getBean(SpringContextHolder.java:56)
    at com.chseeker.modules.use.entity.ToolUserInfo.<clinit>(ToolUserInfo.java:26)
    ... 75 more

    这个是因为,,applicaitonContext没有初始化,查看

    发现,是通过注释加载的,,我就想,是不是,我的定时任务比springContextHolder加载的早,造成的呢?
    于是,,我在spring-context.xml中写入<bean class="com.thinkgem.jeesite.common.utils.SpringContextHolder" lazy-init="false"/>

    ,最后发布到linux中,,启动,问题解决
    最后的最后,,为什么windows下可以,linux下不可以呢???

  • 相关阅读:
    从图片中提取html格式的布局
    javascript语法
    2015 9月2日 工作计划与执行
    2015 9月1日 工作计划与执行
    支付模块结构设计
    ubuntu下的pycharm4中文路径乱码
    2015 8月31 工作计划与执行
    25个git进阶技巧 2015-05-12 16:04 34人阅读 评论(0) 收藏
    Model/View框架总体架构 分类: QT学习实践 2015-05-11 22:05 34人阅读 评论(0) 收藏
    用Dom处理XML文件 分类: QT学习实践 2015-05-11 21:16 30人阅读 评论(0) 收藏
  • 原文地址:https://www.cnblogs.com/ztgzlu/p/8046398.html
Copyright © 2011-2022 走看看