Java问题:tomcat启动报错,如下!

严重: 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

原因:这个是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

温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2017-12-16
java.lang.UnsupportedClassVersionError

这个是JDK版本不对造成的。

即你用某版本的JDK编译的class,放在另一版本JDK上去运行,就容易发生这种异常了(常常是高版本编译在低版本上运行时发生)。
这里显然你的Tomcat用的JDK与你编译用的JDK不一样,换成一致的版本就OK了。追答

有问题可以追问

本回答被提问者采纳
相似回答