JSF - шаблон Spring JDBC
Когда я пытаюсь использовать Spring JDBC Template с JSF/ICEFaces, он выдает некоторые ошибки.
Вот мой spring.xml
<beans ...>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@//localhost:1521/xe" />
<property name="username" value="hr" />
<property name="password" value="hr" />
</bean>
<bean id="testDAO" class="com.sura2k.TestDAOImpl">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
Вот ДАО.
public class TestDAOImpl extends JdbcDaoSupport implements TestDAO {
@Override
public int getTotal(){
String sql = "SELECT COUNT(*) FROM CUSTOMER";
int total = getJdbcTemplate().queryForInt(sql);
return total;
}
}
Исключения...
....
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]
...