TNS URL, 사용자 이름 및 암호를 사용하여 Oracle 11i Database에 연결하려고합니다. . 데이터 소스가 JNDI에 의해 성공적으로 조회되었지만, 연결을 얻을 수 없습니다. 대신 다음 스택 추적을 참조하십시오.java.sql.SQLException : 적절한 드라이버 없음 연결 URL에 대해 'oracle.jdbc.driver.OracleDriver'JDBC 드라이버를 만들 수 없습니다.
java.sql.SQLException: No suitable driver
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2151)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2032)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1532)
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:204)
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373)
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:427)
org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
com.sun.proxy.$Proxy30.getOutOfDateSpanishContent(Unknown Source)
com.myproject.cms.tools.controller.OutOfDateSpanishDrcController.downloadDcrReportAsCsv(OutOfDateSpanishDrcController.java:57)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
My Maven 설정은 다음과 같습니다.
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>6</version>
</dependency>
내 스프링 MVC 응용 프로그램은 내가 $CATALINA_HOME/lib
위치에 오라클 jar 파일을 톰캣 (8)에 배포되었습니다. $CATALINA_HOME/conf/context.xml
에서 내 JNDI 구성이
<Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource" username="username" password="password" driverClassName="oracle.jdbc.driver.OracleDriver" url="Jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<host_name>)(PORT=49125))(CONNECT_DATA=(SERVER=DEDICATED)(service_name=<service_name>)))" maxTotal="10" maxIdle="5" poolPreparedStatements="true" validationQuery="select 1" />
내 web.xml을 구성
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the configuration for the web application.
</description>
<res-ref-name>
jdbc/myDB
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
아래에 주어진 나는 내가 뭘 잘못 모르겠습니다. DriverManager API를 사용하여 성공적으로 연결할 수 있습니다. 다음 스레드를 읽었지만 잘못하고있는 것이 무엇인지 알 수 없습니다. 나는 받아 들인 해결책에서 모든 제안을 시도했으나 아무 소용이 없다. java.sql.SQLException: No suitable driver