apache-tomcat模式下连接池的问题?

03-07-16 新疆朋友
我在tomcat-standlone模式下,配置oracle数据库的连接池成功,当我与apache 联合使用,既apache-tomcat模式下的service,将同样的配置由service(tomcat-standlone)下拷贝到service(apache-tomcat)下,运行同样的程序,http://XXX.XXX:8080/(tomcat-standlone)运行正常,但是http://XXXX.XXXX/下出现下列错误

ava.sql.SQLException: Cannot load JDBC driver class 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529) at

我的调用语句是con = ds.getConnect() ,但是我使用jdbc的方式连接数据库没有问题。

我的httpd.conf部分如下:

LoadModule webapp_module libexec/mod_webapp.so

LoadModule php4_module libexec/libphp4.so

AddModule mod_webapp.c

AddModule mod_php4.c

WebAppConnection warpConnection warp localhost:8008

WebAppDeploy examples warpConnection /examples

web.xml :

<web-app>

<description>Oracle Datasource example</description>

<servlet-mapping>

<servlet-name>invoker</servlet-name>

<url-pattern>/servlet/*</url-pattern>

</servlet-mapping>

<resource-ref>

<res-ref-name>jdbc/myoracle</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</web-app>

server.xml :

<Service name="Tomcat-Apache">

<Connector className="org.apache.catalina.connector.warp.WarpConnector"

port="8008" minProcessors="5" maxProcessors="75"

enableLookups="true" appBase="webapps"

acceptCount="10" debug="0"/>

<Engine className="org.apache.catalina.connector.warp.WarpEngine"

name="Apache" debug="0">

<Logger className="org.apache.catalina.logger.FileLogger"

prefix="apache_log." suffix=".txt" timestamp="true"/>

<Realm className="org.apache.catalina.realm.MemoryRealm" />

<Host name="localhost" debug="0" appBase="webapps"

unpackWARs="true" autoDeploy="true">

<Context path="/examples" docBase="examples" debug="0"

reloadable="true" crossContext="true">

<Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/myoracle">

<parameter>

<name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>

</parameter>

<parameter>

<name>driverClassName</name>

<value>oracle.jdbc.driver.OracleDriver</value>

</parameter>

<parameter>

<name>url</name>

<value>jdbc:oracle:thin:@oracle.tpe:1521:ORC1</value>

</parameter>

<parameter>

<name>username</name>

<value>scott</value>

</parameter>

<parameter>

<name>password</name>

<value>tiger</value>

</parameter>

<parameter>

<name>maxActive</name>

<value>20</value>

</parameter>

<parameter>

<name>maxIdle</name>

<value>10</value>

</parameter>

<parameter>

<name>maxWait</name>

<value>-1</value>

</parameter>

</ResourceParams>

</Context>

</Host>

</Engine>

</Service>

猜你喜欢