title: JSF - Spring JDBC Template
body: <p>When I'm trying to use Spring JDBC Template with JSF/ICEFaces, it throws some errors.</p>
  
  <p>Here is my <code>spring.xml</code></p>
  
  <pre><code>&lt;beans ...&gt;
  
      &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /&gt;
          &lt;property name="url" value="jdbc:oracle:thin:@//localhost:1521/xe" /&gt;
          &lt;property name="username" value="hr" /&gt;
          &lt;property name="password" value="hr" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id="testDAO" class="com.sura2k.TestDAOImpl"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Here is the DAO.</p>
  
  <pre><code>public class TestDAOImpl extends JdbcDaoSupport implements TestDAO {
  
  
      @Override
      public int getTotal(){
  
          String sql = "SELECT COUNT(*) FROM CUSTOMER"; 
          int total = getJdbcTemplate().queryForInt(sql);     
          return total;
      }
  }
  </code></pre>
  
  <p>Exceptions...</p>
  
  <pre><code>....
  
  Caused by: org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'dataSource' defined in class path resource 
  [META-INF/database/spring.datasource.xml]: Error setting property values; 
  nested exception is org.springframework.beans.PropertyBatchUpdateException; 
  nested PropertyAccessExceptions (1) are:
  
  PropertyAccessException 1: org.springframework.beans.MethodInvocationException: 
  Property 'driverClassName' threw exception; nested exception is 
  java.lang.IllegalStateException: Could not load JDBC driver class 
  [oracle.jdbc.driver.OracleDriver]
  
  ...
  </code></pre>