数据库方言 when no Connection available

问题描述

数据库方言 when no Connection available

今天启动tomcat时报错了,'hibernate.dialect' must be set when no Connection available,这个错误没有连接的时候需要数据库方言,感觉可奇怪,在单位的电脑没问题,放在家里就错了,前几天没问题,今天就错了
2015-2-24 12:56:28 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:Commonbinarycom.sun.java.jdk.win32.x86_1.6.0.013bin;E:Commonpluginscom.genuitec.eclipse.easie.tomcat.myeclipse_8.5.0.me201003121946tomcatbin
2015-2-24 12:56:28 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2015-2-24 12:56:28 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 346 ms
2015-2-24 12:56:28 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2015-2-24 12:56:28 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.13
2015-2-24 12:56:29 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN No appenders could be found for logger (org.springframework.core.CollectionFactory).
log4j:WARN Please initialize the log4j system properly.
2015-2-24 12:56:32 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2015-2-24 12:57:03 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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 available
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:2163)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2159)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1383)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
... 39 more
2015-2-24 12:57:03 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2015-2-24 12:57:03 org.apache.catalina.core.StandardContext start
严重: Context [/Test20150223] startup failed due to previous errors
2015-2-24 12:57:03 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
2015-2-24 12:57:03 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2015-2-24 12:57:03 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2015-2-24 12:57:03 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/16 config=null
2015-2-24 12:57:03 org.apache.catalina.startup.Catalina start
信息: Server startup in 34874 ms

解决方案

好了我自己来回答。。。。。我的mysql 是6.0.11版本的,然后jar是5.1.15,主要报的错误是当没有连接时需要数据库方言,
感觉好奇怪同样的东西以前都没错,以前的是单位的电脑数据库版本好像不一样,
然后我还以为是数据库方言不对,一直在方言上修改
折腾了几个小时,然后感觉不可能没有连接呀,怎么会没有链接呢,
然后就在网上下了一个jar,然后更换配置的driver,就好了

时间: 2024-10-03 23:49:57

数据库方言 when no Connection available的相关文章

类的实例化-对数据库的操作,connection实例化的问题

问题描述 对数据库的操作,connection实例化的问题 我在某个dao包的deal类中有好几个方法,例如对数据库的增删改差方法,但我需要调用数据库接口(例如util包中的connection类),1:直接在deal类最上面实例化connection类,在各个方法中使用实例化的对象.2:在各个方法中实例化connection类...这两种处理方式一样么?或者哪一种好点? 解决方案 就是对象多少的问题,第一种你只会有一个连接对象,第二种每个方法调用都会实例化一个对象其实会浪费很多的资源

spring配置ibatis oracle数据库改成mysql数据库遇到数据库方言问题

问题描述 spring配置ibatisoracle数据库改成mysql数据库遇到数据库方言问题<!--spring配置ibatis--><beanid="sqlMapClient"class="org.framework.ibatis.spring.SqlMapClientFactoryBean"><!--Mysql,Sqlserver通用ibatis配置文件-->propertyname="configLocation

Hibernate对各数据库的连接方言

<session-factory> <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property> <property name="connection.url">jdbc:jtds:sqlserver://ALEX:1134/News</property> <!--for oracle 9 &l

Hibernate 不同数据库的连接及SQL方言

<!--MySql 驱动程序 eg. mysql-connector-java-5.0.4-bin.jar-->  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>  <property name="connection.driver_class">com.mysql.jdbc.Driver</property>  

thinkphp5 数据库 链接 Connection

代码里原有的注释已经非常完善了.不需要我在做什么了..... thinkphp5.x之数据库操作相关解析 Db类 http://blog.csdn.net/fenglailea/article/details/52728705 thinkphp5.x之Collection(集合)解析 php集合 http://blog.csdn.net/fenglailea/article/details/52723586 风.fox namespace think\db; use PDO; use PDOSt

Hibernate:利用配置文件生成数据库

目前很多人使用Hibernate作为持久层,如果我们已经写了配置文件poweracl.hbm.xml,则不必再费劲写SQL的DDL.除了利用工具SchemaExport之外,还可以编写程序来自动初始化数据库,并且生成SQL DDL. (1)Hibernate配置文件hibernate.cfg.xml <?xml version='1.0' encoding='gb2312'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hiber

Hibernate4 (面向对象的数据库操作)

JPA,java persistance api,java持久层接口,即与数据库打交道的一些接口.实现交给各个厂商去实现. ORM,Object/Relation Mapping,对象/关系数据库映射.面向对象的数据库操作,底层仍是sql语句. 获得 hibernate的maven依赖. <dependencies> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector

应届生 面试东软 碰到问题 不用数据库之间的的问题

问题描述 那个面试官 问我一个项目 一会儿用ORACLE 一会用MSSQL 请问你用什么方式 实现 数据库的转换 什么的 很是郁闷 应届生问这些 解决方案 这个问题至少要答出来2方面1 orm技术使用 hibernate等支持数据库方言的东东2 使用多态技术 加上 IOC ,当你使用Oracle时,加载 Oracle的DAO,使用MySQL的时候使用MySQL的dao这个是很典型的IoC这个问题不是应不应届的问题,不要用"应届"作理由.应届不是理由,是因为你浪费的大学时光.解决方案二:

java中Hibernate中的数据库对象详解

1.hibernate.cfg.xml  代码如下 复制代码 <!DOCTYPE hibernate-configuration PUBLIC         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuratio