2015-05-14 100 views
0

我無法在Tomcat7中獲得數據庫連接。我使用Oracle Linux作爲操作系統。以下是我的數據庫連接池配置。無法爲連接URL'null'創建類''的JDBC驅動程序:dbcp.SQLNestedException

的server.xml

<GlobalNamingResources> 
<!-- Editable user database that can also be used by 
    UserDatabaseRealm to authenticate users 
--> 
<Resource name="UserDatabase" auth="Container" 
      type="org.apache.catalina.UserDatabase" 
      description="User database that can be updated and saved" 
      factory="org.apache.catalina.users.MemoryUserDatabaseFactory" 
      pathname="conf/tomcat-users.xml" /> 

<Resource name="jdbc/weblogin01" 
    auth="Container" 
    type="javax.sql.DataSource" 
    driverClassName="oracle.jdbc.OracleDriver" 
    url="${resource.weblogin01.url}" 
    username="${resource.weblogin01.username}" 
    password="${resource.weblogin01.password}" 
    initialSize="2" 
    maxActive="20" 
    maxIdle="10" 
    minIdle="2" 
    maxWait="-1" 
    testWhileIdle="true" 
    timeBetweenEvictionRunsMillis="20000" 
    validationQuery="select * from dual" /> 

<Resource name="jdbc/osswebportal" 
    auth="Container" 
    type="javax.sql.DataSource" 
    driverClassName="oracle.jdbc.OracleDriver" 
    url="${resource.osswebportal.url}" 
    username="${resource.osswebportal.username}" 
    password="${resource.osswebportal.password}" 
    initialSize="1" 
    maxActive="20" 
    maxIdle="10" 
    maxWait="-1" 
    testWhileIdle="true" 
    timeBetweenEvictionRunsMillis="60000" 
    validationQuery="select * from dual" /> 

的web.xml

<resource-ref> 
>   <res-ref-name>jdbc/osswebportal</res-ref-name> 
>   <res-type>javax.sql.DataSource</res-type> 
>   <res-auth>Container</res-auth> 
>   <res-sharing-scope>Shareable</res-sharing-scope> 
>  </resource-ref> 
>  <resource-ref> 
>   <res-ref-name>jdbc/weblogin01</res-ref-name> 
>   <res-type>javax.sql.DataSource</res-type> 
>   <res-auth>Container</res-auth> 
>   <res-sharing-scope>Shareable</res-sharing-scope> 
>  </resource-ref> 

的context.xml

<ResourceLink global="jdbc/weblogin01" name="jdbc/weblogin01" type="javax.sql.DataSource"/> 
    <ResourceLink global="jdbc/osswebportal" name="jdbc/osswebportal" type="javax.sql.DataSource"/> 

我也定義在tomcat的catalina.properties的所有數據庫的細節

resource.osswebportal.url =的jdbc:神諭:薄:@ test.com:1522:GPSP resource.osswebportal.username =用戶

resource.osswebportal.password =密碼

resource.weblogin01.url = JDBC:預言:瘦:@ TEST2:1522:GSPS resource.weblogin01.username =用戶1

resource.weblogin01.password =密碼

  • ,也是我已經把兩個tomcat的lib目錄以及應用程序的WEB_INF/lib目錄下的jdbc罐子。

回答

0

把Driver Jar文件放在服務器lib文件夾中,我想這會解決你的問題。

+0

你是什麼意思的服務器庫文件夾。對不起。我沒有得到你 – Shibankar

+0

在你的welogic域文件夾中將會有lib文件夾放入oracle驅動程序 –

+0

如果你問我在應用程序的lib目錄中添加jdbc jar,那麼它也存在於應用程序的WEB-INT中/ lib directoyr。仍然不清楚webogic域文件夾 – Shibankar

相關問題