Raj,
Thanks for the tip - I tried your suggestion by moving the JNDI-How To
example out of the standalone tomcat service and into the Tomcat-Apache
service. Bear in mind that the example works Ok in tomcat standalone.
The Tomcat-Apache service I am using is the default provided and works
in all other ways. To that I added the virtual host and the context.
In other words in the following sample, what I have added to the default
Apache-Tomcat service is contained in and includes the Host tags.
I am still getting the error.
<!-- Define an Apache-Connector Service -->
<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" />
<!-- Define the default virtual host -->
<Host name="prod_host" debug="9" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="prod_host_log." suffix=".txt"
timestamp="true"/>
<!-- test context -->
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>username</name>
<value>javausr</value>
</parameter>
<parameter>
<name>password</name>
<value>javadud</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.gjt.mm.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
<!-- end test context -->
</Host>
</Engine>
</Service>
</Server>
Raj Saini wrote:
> Hi jake,
>
> You woll need to define a context under a Tomcat-Apache service. I
> belive you are using the context defined in the Stand-Alone service.
> you must have a virtual host and your context under this virtual host.
>
> I hope this helps you.
>
> Raj
>
> Jake Tweer wrote:
>
>> I'm getting the same error with MySQL and I've seen posts for
>> PostgreSQL, MySQL and Oracle. I have followed all suggestions with no
>> luck except for one case - the example given in the JNDI - How To
>> works for me. The example is using standalone Tomcat and that works.
>> As soon as I use Apache/mod_webapp I get the exception Cannot load
>> JDBC driver class 'null'.
>>
>>
>>
>> Robert Herold wrote:
>>
>>> I've been happily using tomcat 4.0.4 for a while, and thought I'd
>>> upgrade to
>>> version 4.1.12. Alas, I cannot get tomcat to find my Oracle JDBC driver
>>> when I use 4.1.12. It worked fine in 4.0.4.
>>>
>>> Any ideas what might be wrong?
>>>
>>> My classes12.jar is in common/lib where it is supposed to be. It's
>>> the same
>>> file as I used under tomcat 4.0.4, so it is known to be good.
>>>
>>> I followed the configuration steps for setting up the JNDI Datasource
>>> very
>>> carefully.
>>>
>>> The exception I get is:
>>>
>>> Caused by: java.sql.SQLException: Cannot load JDBC driver class 'null'
>>> at
>>> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav
>>>
>>> a:529)
>>> at
>>> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:3
>>>
>>> 12)
>>> at
>>> com.cotagesoft.common.XDataSource.getConnection(XDataSource.java:107)
>>> ... 31 more
>>>
>>> My resource definition in server.xml is:
>>>
>>> <DefaultContext debug="0" reloadable="true">
>>> <Resource name="jdbc/CotagesoftDB" auth="Container"
>>> type="javax.sql.DataSource"/>
>>> <ResourceParams name="jdbc/CotagesoftDB">
>>> <parameter>
>>> <name>factory</name>
>>> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>>> </parameter>
>>> <parameter>
>>> <name>username</name>
>>> <value>fred</value>
>>> </parameter>
>>> <parameter>
>>> <name>password</name>
>>> <value>fred</value>
>>> </parameter>
>>> <parameter>
>>> <name>driverClassName</name>
>>> <value>oracle.jdbc.driver.OracleDriver</value>
>>> </parameter>
>>> <parameter>
>>> <name>driverName</name>
>>> <value>jdbc:oracle:thin:@localhost:1521:ctg</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>
>>> </DefaultContext>
>>>
>>> And it is referenced in web.xml with:
>>>
>>> <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 server.xml file.
>>> </description>
>>>
>>> <res-ref-name>jdbc/CotagesoftDB</res-ref-name>
>>> <res-type>javax.sql.DataSource</res-type>
>>> <res-auth>Container</res-auth>
>>>
>>> </resource-ref>
>>>
>>> Any ideas on what to try would be appreciated. Thanks.
>>>
>>> -- bob
>>>
>>> ----------
>>> Robert Herold
>>> Cotagesoft, Inc.
>>> 650 474 9013 x808
>>>
>>>
>>>
>>> --
>>> To unsubscribe, e-mail:
>>> <mailto:[EMAIL PROTECTED]>
>>> For additional commands, e-mail:
>>> <mailto:[EMAIL PROTECTED]>
>>>
>>>
>>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
>> <mailto:[EMAIL PROTECTED]>
>>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>