当前位置: 首页 > 工具软件 > Dialect App > 使用案例 >

Dialect class not found: org.hibernate.dialect.Oracle10gDialect 报错解决

范福
2023-12-01

将项目打包,部署到tomcat下,启动tomcat,控制台报错如下:

2014-03-02 23:24:29,975 [/// - ] ERROR org.springframework.web.context.ContextLoader - Context initialization failed

nested exception is org.springframework.beans.factory.BeanCreationException:

Error creating bean with name 'TempDao' defined in file [/../WEB-INF/classes/com/../TempDao.class]:

Initialization of bean failed;

nested exception is org.springframework.beans.factory.BeanCreationException:

Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-hibernate.xml]:

Invocation of init method failed; nested exception is org.hibernate.HibernateException:

Dialect class not found: org.hibernate.dialect.Oracle10gDialect 

...

at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_30]

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) [bootstrap.jar:6.0.32]

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) [bootstrap.jar:6.0.32]


报错信息很明显,applicationContext-hibernate.xml文件的配置有错误:Oracle10gDialect没有配置或不是该值。

但是查找配置文件,发现配置没有问题,就是该值不假。

google查询该问题,全部都是说Oracle10gDialect配置有问题。

既然大家都这么说,看来确实是这个问题,于是乎,断点该地方进行跟踪,发现其值仍然是Oracle10gDialect,没有问题,

真是怪了去了,难道是单词拼错了???,拷贝出来拿对比工具比较下...

奇迹出现了,拷贝时发现,后面竟然多了个空格,去掉空格,一切又恢复了正常.....

分析了下,Spring使用反射机制时,没有将后端的空格去掉,导致该问题。

看来肉眼是不能相信的了。。。。

 

唉,现在还有啥能信呢。。。


 类似资料: