天天看点

hibernate 报错Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

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

hibernate 报错Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

今天使用了一下hibernate,刚刚用就报错,就是如上错误了,信息说的是加载配置文件有问题

解决如下;

(1)第一步:

         查看自己的配置文件是否有错,这个问题自己去查一下就可以了,这里也没有什么好说的

(2)第二步

         其实还有一点就是你在代码里有没有写上加载配置文件的代码:就是

hibernate 报错Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

cfg.configure();

之后就是junit就是正确颜色了

hibernate 报错Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]