Java问题:tomcat启动报错,如下!
严重:Exceptionsendingcontextinitializedeventtolistenerinstanceofclassorg.springframewor...
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
错误提示:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\jiejing\WEB-INF\classes\com\jiejing\model\sys\Information.class]; nested exception is java.lang.UnsupportedClassVersionError: org/hibernate/search/annotations/Indexed : Unsupported major.minor version 51.0 (unable to load class org.hibernate.search.annotations.Indexed)
错误提示:Caused by: java.lang.UnsupportedClassVersionError: org/hibernate/search/annotations/Indexed : Unsupported major.minor version 51.0 (unable to load class org.hibernate.search.annotations.Indexed)
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
错误提示:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 展开
错误提示:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\jiejing\WEB-INF\classes\com\jiejing\model\sys\Information.class]; nested exception is java.lang.UnsupportedClassVersionError: org/hibernate/search/annotations/Indexed : Unsupported major.minor version 51.0 (unable to load class org.hibernate.search.annotations.Indexed)
错误提示:Caused by: java.lang.UnsupportedClassVersionError: org/hibernate/search/annotations/Indexed : Unsupported major.minor version 51.0 (unable to load class org.hibernate.search.annotations.Indexed)
严重: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener
错误提示:java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 展开
2个回答
展开全部
原因:这个是JDK版本不对造成的。
解决方法:
1、即你用某版本的JDK编译的class,放在另一版本JDK上去运行,就容易发生这种异常了(常常是高版本编译在低版本上运行时发生)。
2、这里显然你的Tomcat用的JDK与你编译用的JDK不一样,换成一致的版本就OK了。
方法二:
1、在对应DaoImpl中加入sessionfactory的set方法、get方法。
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
继承JdbcDaoSupport。
UserDaoImpl extends JdbcDaoSupport
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询