2011-05-09 13:59:54,125 INFO [STDOUT] Job NMS.SOC_StatPOlicy_1 threw an unhandled Exception:
java.lang.IllegalArgumentException: No SessionFactory specified
at org.springframework.util.Assert.notNull(Assert.java:112)
at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:283)
at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:235)
at org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:475)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:344)
at com.officeten.nms.task.schedul.dao.impl.RunQuartzDaoImpl.executeSQL(RunQuartzDaoImpl.java:367)
at com.officeten.nms.task.schedul.dao.impl.RunQuartzDaoImpl.updateStatPolicyDate(RunQuartzDaoImpl.java:344)
at com.officeten.nms.task.schedul.service.impl.RunQuartzServiceImpl.updateStatPolicyDate(RunQuartzServiceImpl.java:113)
at com.officeten.nms.task.schedul.QuartzStatPolicyJob.executeInternal(QuartzStatPolicyJob.java:21)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
解决方法:
private SessionFactory sessionFactory;
public void setQuartzSssionFactory(SessionFactory sessionFactory) {
this. sessionFactory = sessionFactory;
}
HibernateTemplate hibernateTemplate = new HibernateTemplate(sessionFactory);
List<Object[]> list = hibernateTemplate.executeFind(
new HibernateCallback() {
… …
}
分享到:
相关推荐
使用hibernate各个版本的开发,创建sessionfactory的各种方法
HibernateSessionFactory.java
hibernate中的SessionFactoryhibernate中的SessionFactoryhibernate中的SessionFactory
针对sessionFactory没有出现的可能原因;
一个实例小工程,讲解的是将hibernate的sessionFactory交给spring管理的配置方法
用于获得Session会话及关闭Session会话
NULL 博文链接:https://chaoyi.iteye.com/blog/2148991
Hibernate中的sessionFactory
博文链接:https://shaqiang32.iteye.com/blog/201918
Hibernate中涉及到的增加,删除,查询,修改,操作.
(S+S+H)(private_SessionFactory_属性_dao类)_方式_SSH_整合--总结
Session s= HibernateSessionFactory.getSession(); 就是Hibernate的工具java类
NULL 博文链接:https://jie2workjava.iteye.com/blog/901847
NULL 博文链接:https://zgdkik.iteye.com/blog/1835667
spring管理sessionFactory,将sessionFactory注入基础类,将基础类设置为单例模式,下载后直接部署使用,根据实体类自行建表
NULL 博文链接:https://tedtian.iteye.com/blog/1988917