【发布时间】:2015-10-29 23:03:27
【问题描述】:
我想使用 Spring 实现 Oracle Pooling DataSource,如下所述: http://docs.spring.io/spring-data/jdbc/docs/current/reference/html/orcl.datasource.html
但是,我遇到了这个问题:
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/orcl]
Offending resource: class path resource [applicationContext.xml]
据我了解,这个问题是由于 Spring 无法找到 Oracle JDBC Driver 造成的。但是,驱动程序在我的类路径中;所以,我不知道是什么导致了这个问题。
applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:orcl="http://www.springframework.org/schema/data/orcl"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/data/orcl http://www.springframework.org/schema/data/orcl/spring-data-orcl-1.0.xsd">
<orcl:pooling-datasource
id="dataSource"
url="jdbc:oracle:thin:@//abc.ca:1527/abc_default.abc.ca"
username="abc"
password="abc"/>
pom.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.1.2.RELEASE</version>
</dependency>
【问题讨论】:
-
你有没有弄明白这个?我也面临同样的问题。
-
我放弃了。我在使用 Oracle 池数据源时遇到了太多问题;因此,我按照此处所述移至 C3P0:stackoverflow.com/questions/33553532/…
标签: java spring oracle jdbc oracle11g