spring 应用程序无法加载 JDBC 驱动程序类:oracle.jdbc.driver.OracleDriver
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26986992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
spring application Could not load JDBC driver class :oracle.jdbc.driver.OracleDriver
提问by Rekha S
I am new to spring and developing spring jdbc application. but driver class is not loaded. am getting exception that
我是 spring 和开发 spring jdbc 应用程序的新手。但未加载驱动程序类。我得到了例外
org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]
org.springframework.beans.MethodInvocationException:属性“driverClassName”抛出异常;嵌套异常是 java.lang.IllegalStateException: 无法加载 JDBC 驱动程序类 [oracle.jdbc.driver.OracleDriver]
and my xml file is as follows:
我的xml文件如下:
<bean id="ds" 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="system" />
property name="password" value="surekha" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="ds"></property>
</bean>
<bean id="edao" class="EmployeeDao">
<property name="jdbcTemplate" ref="jdbcTemplate"></property>
</bean>
</beans>
anyone help me to this problem. thanks in advance.
任何人都可以帮助我解决这个问题。提前致谢。
回答by Patrikoko
In your pom.xml , add this dependency :
在您的 pom.xml 中,添加此依赖项:
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
回答by Kiran P Fegade
Add Following dependency in pom.xml
在 pom.xml 中添加以下依赖项
<dependency>
<groupId>com.oracle</groupId>
<artifactId>oracle</artifactId>
<version>10.2.0.2.0</version>
</dependency>
回答by Caio Augusto Papai
I had the Same problem even adding the maven dependency in my pom.xml
我什至在 pom.xml 中添加了 maven 依赖项,也遇到了同样的问题
I downloaded manualy the .jar in https://mvnrepository.com/artifact/com.oracle/ojdbc6/12.1.0.1-atlassian-hosted
我在https://mvnrepository.com/artifact/com.oracle/ojdbc6/12.1.0.1-atlassian-hosted 中手动下载了 .jar
and it worked for my project.
它适用于我的项目。
回答by mahi mahendra
Add this jdbc-oracle.jar file into your project...
将此 jdbc-oracle.jar 文件添加到您的项目中...
jdbc-oracle.jar is available in http://www.java2s.com/Code/Jar/j/Downloadjdbcoraclejar.htm
jdbc-oracle.jar 位于http://www.java2s.com/Code/Jar/j/Downloadjdbcoraclejar.htm

