Exception sending context initialized event to listener instance of class org.springframework.web.c
来源:互联网 发布:java jdk1.7下载地址 编辑:程序博客网 时间:2024/06/16 18:49
今天试着重新搭建了SSH(spring+Struts+hibernate)框架,启动Tomcat测试搭建是否成功时发现出了问题,详细错误如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection avalable at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:566) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Caused by: org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection avalable at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:107) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:138) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ... 36 more
调试了好久发现spring配置问题,spring配置头为:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">`
正确的配置头为:
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
然而修改后还是显示spring配置异常,检查了路径问题,修改了web.xml文件中对应的代码
<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value></context-param>
重新启动Tomcat,运行成功
明白其中的规律后问题就很好解决了,有时候碰到的错误多了等下下次再碰到的时候也会知道相应解决方法。
阅读全文
0 0
- Exception sending context initialized event to listener instance of class org.springframework.web.c
- Exception sending context initialized event to listener instance of class org.springframework.web.c
- Exception sending context initialized event to listener instance of class org.springframework.web.c
- Exception sending context initialized event to listener instance of class org.springframework.web.c
- Exception sending context initialized event to listener instance of class org.springframework.web.c
- Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
- 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe
- Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
- Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
- Exception sending context initialized event to listener instance of class org.springframework.web.ut
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- Exception sending context initialized event to listener instance of class org.springframework.web.co
- : Exception sending context initialized event to listener instance of class org.springframework.web.
- vue从入门到放弃--- 时间戳 跨域
- 浙大PAT甲级-1020
- 第五章 JavaScript HTML DOM
- 各个历史版本 cuda toolkit 下载链接
- 2017-07-05(servlet)
- Exception sending context initialized event to listener instance of class org.springframework.web.c
- <input type="image">标签引发的form表单自动提交
- Android adb安装apk时提示Invalid APK file
- Eclipse中导入其他来源的project时报错:setting build path has encountered a problem的解决方法
- 如何编译各平台使用的库:以编译tolua为例
- 关于微信企业付款(提现)返回错误信息的调试
- JAVA显示所输入的用户名与密码是否正确
- bzoj3687 -- bitset优化DP
- java web 汇总