配置ssh框架啟動tomcat服務器報異常Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]


在Spring中配置jdbc時,引用的是dbcp.jar包,在db.properties配置文件中,使用了之前的properties配置文件的用戶名username(MySql用戶名)

然后在啟動服務器報了如下幾個異常:

1、org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

2、Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

3、Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

 

applicationContext.xml配置文件

db.properties.xml配置文件

 

后來檢查發現,在加載讀取配置文件的標簽中

<context:property-placeholder location="classpath:dataSource.properties"  />  少了一條屬性system-properties-mode="FALLBACK",

系統默認為system-properties-mode="ENVIRONMENT"  意思就是從系統環境中去讀取,把電腦名當做MySlq的用戶名,修改之后運行成功。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM