java.sql.SQLException: 未找到合适的驱动程序 jdbc:oracle:thin
java.sql.SQLException: No suitable driver found jdbc:oracle:thin
我正在尝试在我的本地 tomcat 服务器上部署一个基于 spring 的 Web 应用程序。以下是我的申请详情:
基于 - Spring 的 Web 应用程序 (war)
- Tomcat 6台服务器
- Java 1.6
- 甲骨文数据库
以下按jdbc配置:
仅用于 tomcat 设置的配置。
javax.persistence.jdbc.drive=oracle.jdbc.OracleDriver
javax.persistence.jdbc.url=jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
javax.persistence.jdbc.user=test
javax.persistence.jdbc.password=test
我还在我的 /lib 文件夹中添加了 ojdbc6.jar,ojdbc14.jar
我部署了我的 war 文件,没有任何问题。但是,当我的应用程序尝试连接到数据库时,它会抛出错误:"java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west"
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
Error Code: 0
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:517)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:445)
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:366)
... 81 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:319)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:109)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:330)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:293)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:418)
at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:216)
at org.eclipse.persistence.sessions.server.ConnectionPool.startUp(ConnectionPool.java:504)
at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:484)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:633)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:208)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
... 87 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98)
... 97 more
我已经看到很多 post 有类似的问题,但我不确定我错过了什么。
此错误取决于您的建筑结构。将 jar 文件添加到您的 lib 文件夹不会做任何事情。
您应该将 jar 文件添加到类路径中。
如果您通过 IDE 构建您的项目,假设是 eclipse,您应该将它添加到 .classpath 文件中。如果您使用的是 Idea,则应将其添加到您的 .iml 文件等。
如果您通过 ant 构建您的项目,您应该将 jar 地址添加到您的 build.xml 文件中。
我想你没有使用 maven。
我正在尝试在我的本地 tomcat 服务器上部署一个基于 spring 的 Web 应用程序。以下是我的申请详情:
-
基于
- Spring 的 Web 应用程序 (war)
- Tomcat 6台服务器
- Java 1.6
- 甲骨文数据库
以下按jdbc配置:
仅用于 tomcat 设置的配置。
javax.persistence.jdbc.drive=oracle.jdbc.OracleDriver
javax.persistence.jdbc.url=jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
javax.persistence.jdbc.user=test
javax.persistence.jdbc.password=test
我还在我的 /lib 文件夹中添加了 ojdbc6.jar,ojdbc14.jar
我部署了我的 war 文件,没有任何问题。但是,当我的应用程序尝试连接到数据库时,它会抛出错误:"java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west"
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
Error Code: 0
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:517)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:445)
at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:366)
... 81 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
Error Code: 0
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:319)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:109)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:330)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:293)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:418)
at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:216)
at org.eclipse.persistence.sessions.server.ConnectionPool.startUp(ConnectionPool.java:504)
at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:484)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:633)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:208)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
... 87 more
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@coursesdev.cvbaybp20ew7.eu-west-1.rds.amazonaws.com:1521:DEVCRS
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98)
... 97 more
我已经看到很多 post 有类似的问题,但我不确定我错过了什么。
此错误取决于您的建筑结构。将 jar 文件添加到您的 lib 文件夹不会做任何事情。 您应该将 jar 文件添加到类路径中。 如果您通过 IDE 构建您的项目,假设是 eclipse,您应该将它添加到 .classpath 文件中。如果您使用的是 Idea,则应将其添加到您的 .iml 文件等。 如果您通过 ant 构建您的项目,您应该将 jar 地址添加到您的 build.xml 文件中。 我想你没有使用 maven。