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下不可以呢???
applicaitonContext属性未注入, 请在applicationContext.xml中定义SpringContextHolder.的更多相关文章
- spring controller中@Value取不到applicationContext.xml中加载配置文件的问题
原因还未查证: http://sunjun041640.blog.163.com/blog/static/256268322014127113844746/ 在使用spring mvc时,实际上是两个 ...
- SSH整合,applicationContext.xml中配置hibernate映射文件问题
今天在applicationContext.xml中配置sessionFactory时遇到了各种头疼的问题,现在总结一下: 1.<property name="mappingDirec ...
- android动画具体解释六 XML中定义动画
动画View 属性动画系统同意动画View对象并提供非常多比view动画系统更高级的功能.view动画系统通过改变绘制方式来变换View对象,view动画是被view的容器所处理的,由于View本身没 ...
- Android——inflate 将一个xml中定义的布局找出来
通俗的说,inflate就相当于将一个xml中定义的布局找出来. 因为在一个Activity里如果直接用findViewById()的话,对应的是setConentView()的那个layout里的组 ...
- applicationContext.xml中的使用${}是代表什么意思?
在applicationContext.xml文件中,使用 ${xxx} 表示的是:调用某个变量,该变量的名称就是{xxx}里面的"xxx". 例如:在applicationC ...
- 在application-context.xml中配置多个property-placeholder
如下所示,直接写多个<context:property-placeholder>标签是会报错的. <context:property-placeholder location=&qu ...
- Tomcat web.xml中定义了文件扩展名到MIME类型的对应关系
Tomcat在返回静态资源时,会根据资源文件的扩展名产生对应的content-type头(也即MIME类型)添加到response header中. 在Tomcat的web.xml规定了扩展名及相应M ...
- Android strings.xml中定义字符串显示空格
<string name="str">字 符 串</string> 其中 就表示空格.如果直接在里面键入空格,无论多少空格都只会显示一个. 用的XML转 ...
- 在properties.xml中定义变量,在application.xml中取值问题
如果为application.xml中的变量赋默认值,同时又在properties.xml中变量赋值,而加载后是取不到properties.xml中的值的问题. 解决这个问题需要加上黑体部分配置: & ...
随机推荐
- js里面的map、filter、forEach、reduce、for in、for of等遍历方法
1.map 遍历数组,改变原数组 [2, 3, 4, 5].map(function(val, key,arr) { return val > 3; }) var data = [ { name ...
- C# linq对分组操作执行子查询
本主题演示创建查询的两种不同方式,此查询将源数据排序成组,然后分别对每个组执行子查询. 每个示例中的基本方法是使用名为 newGroup 的"接续块"对源元素进行分组,然后针对 n ...
- Node.js Stream(流)
Stream 是一个抽象接口,Node 中有很多对象实现了这个接口.例如,对http 服务器发起请求的request 对象就是一个 Stream,还有stdout(标准输出). Node.js,Str ...
- vue 使用axios 跨域请求数据的问题
axios默认是没有jsonp 跨域请求的方法的.一般来说流行的做法是将跨域放在后台来解决,也就是后台开发人员添加跨域头信息. 例如java中的 header,response.setHeader(& ...
- 用笔记本写C程序
首先在Visual Studio Tools 文件中打开 Visual Studio 命令提示(2010),输入命令 notepad 打开记事本,写好程序保存,保存类型:所有文档 文件名:1.c . ...
- DNA序列对齐问题
问题描述: 该问题在算法导论中引申自求解两个DNA序列相似度的问题. 可以从很多角度定义两个DNA序列的相似度,其中有一种定义方法就是通过序列对齐的方式来定义其相似度. 给定两个DNA序列A和B,对齐 ...
- AutoMapper IIS回收引发的 未将对象引用设置到对象实例
一.前言 最近使用AutoMapper的时候,一段时间久会产生System.NullReferenceException:未将对象引用设置到对象的实例.这个问题.后来通过测试,发现部署在IIS上的站点 ...
- Python学习--字典
在Python中通过名字来引用值的数据结构称为映射(mapping).字典是Python中唯一内建(Python解释器本身支持,不需要import)的映射类型.字典中的值没有特殊的顺序,都存储在一个特 ...
- C#中获取当前系统中安装的所有字体及预定义颜色
需要引用命名空间using System.Drawing.Text;.... //获取系统字体:InstalledFontCollection fc = new InstalledFontCollec ...
- Thrift全面介绍
官网:http://thrift.apache.org 简介 Thrift是一个软件框架,用来进行可扩展且跨语言的服务的开发.它结合了功能强大的软件堆栈和代码生成引擎,以构建在 C++, Java ...