Hibernate java.lang.ClassCastException: oracle.jdbc.driver.OracleDriver cannot be cast to org.hiber...

org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:261)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:225)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
    at com.zhaogd.myapplication.test.Test.main(Test.java:30)
Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [oracle.jdbc.driver.OracleDriver]
    at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:197)
    at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:120)
    at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:55)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:105)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:251)
    ... 10 more
Caused by: java.lang.ClassCastException: oracle.jdbc.driver.OracleDriver cannot be cast to org.hibernate.engine.jdbc.connections.spi.ConnectionProvider
    at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:194)
    ... 14 more

今天使用Hibernate 搞了好半天没有搞好,网上搜索这个问题可能是问题太低级了没有搜到 认真比较原来是Hibernate配置文件中provider_class">oracle.jdbc.driver.OracleDriver写错了 应该是

driver_class">oracle.jdbc.driver.OracleDriver 导致orcale中的驱动包ojdbc6.jar,Hibernate没有加载。

 

转载于:https://www.cnblogs.com/zhaogd/p/5215310.html

你可能感兴趣的:(Hibernate java.lang.ClassCastException: oracle.jdbc.driver.OracleDriver cannot be cast to org.hiber...)