Harshit Shrivastava February 2016

Spring MVC Hibernate Specified JDBC Driver oracle.jdbc.pool.OracleDataSource could not be loaded error

I am trying to integrate hibernate with Spring. Until I dont introduce hibernate code & the libraries, it works fine. Here is the code,

welcome-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd"
    xmlns:mvc="http://www.springframework.org/schema/mvc">

    <context:annotation-config />
    <context:component-scan base-package="java4s" />
    <mvc:annotation-driven />
    <bean id="EmployeeService" class="java4s.service.EmployeeServiceImpl" />

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>

<bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation">
            <value>classpath:hibernate.cfg.xml</value>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${jdbc.dialect}</prop>
                <prop key="hibernate.show_sql">true</prop>
            </props>
        </property>
    </bean>

    <bean id="dat        

Answers


Jens February 2016

The driverClassName shouldn't be a Datasource:

class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="oracle.jdbc.pool.OracleDataSource"

It should be the class name of the Driver class: oracle.jdbc.OracleDriver

class="org.springframework.jdbc.datasource.DriverManagerDataSource"
    p:driverClassName="oracle.jdbc.OracleDriver"

Post Status

Asked in February 2016
Viewed 2,941 times
Voted 9
Answered 1 times

Search




Leave an answer