Upon further investigation, I found that the config I use below does work if, 
and only if, I access the servlet from localhost:8080. I'm using mod_webapp 
with Apache 1.3.24 and have the following entry, which seems to work fine, in 
httpd.conf:

<IfModule mod_webapp.c>
 WebAppConnection conn      warp  localhost:8008
 WebAppDeploy     examples    conn  /examples
 WebAppDeploy     formproc    conn  /formproc
 WebAppInfo /webapp-info
</IfModule>

sertver.xml:
<Context path="/formproc" debug="5" docBase="formproc" reloadable="true">

web.xml:
<servlet-mapping>
   <servlet-name>DBTestServlet</servlet-name>
   <url-pattern>/dbTest</url-pattern>
</servlet-mapping>

So, "http://localhost/formproc/dbTest"; fails to instantiate the Connection 
properly, but "http://localhost:8080/formproc/dbTest"; works properly. 

Can anyone explain what is going on here?

(Sorry for the long post, but this is starting to drive me nuts.)

> I am having probelms getting a Connection from the DataSource I get out of
> JNDI. I set up the Resource section of my server.xml as described in the
> HOW-TO for 4.1.9 and am using mm.mysql 2.0.14 with MySQL 3.23.51. The DB
> and dirver seem to work fine together.
>
> It seems I can get the DataSource from the JNDI context as expected, but
> calling getConnection() yeilds an SQLException that says, "Cannot load JDBC
> driver class 'null'". The driver is sitting in common/lib and can be seen
> and used by servlets in my context if I do it 'by hand'. A quick look
> through DBCP's BasicDataSourceFactory confirms 'driverClassName' is the
> correct parameter name for the driver class, and the exception is being
> generated in BasicDataSource:
>
>         // Load the JDBC driver class
>         Class driverClass = null;
>         try {
>             driverClass = Class.forName(driverClassName);
>         } catch (Throwable t) {
>             String message = "Cannot load JDBC driver class '" +
>                 driverClassName + "'";
>             logWriter.println(message);
>             t.printStackTrace(logWriter);
>             throw new SQLException(message);
>         }
>
> Any help would be greatly appreciated.
>
>
> From my server.xml:
> <Resource name="jdbc/form_rev_DB" auth="Container"
> type="javax.sql.DataSource"/>
>  <ResourceParams name="jdbc/form_rev_DB">
>  <parameter>
>   <name>factory</name>
>   <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
>    <parameter><name>maxActive</name><value>100</value></parameter>
>    <parameter><name>maxIdle</name><value>30000</value></parameter>
>    <parameter><name>maxWait</name><value>100</value></parameter>
>    <parameter><name>username</name><value>tcuser</value></parameter>
>    <parameter><name>password</name><value>XXXXX</value></parameter>
>    <parameter>
>      <name>driverClassName</name>
>      <value>org.gjt.mm.mysql.Driver</value>
>    </parameter>
>   <parameter>
>     <name>url</name>
>     <value>jdbc:mysql://localhost:3306/form_rev</value>
>   </parameter>
> </ResourceParams>
>
> From my web.xml:
>   <resource-ref>
>       <description>DB Connection</description>
>       <res-ref-name>jdbc/form_rev_DB</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>   </resource-ref>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to