You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Caroline Jen <ji...@yahoo.com> on 2004/09/15 18:59:06 UTC

Att Is Needed Badly: (Several People Are Reporting exactly the Same Problem)Tomcat 5.0.27 CP Configuration

Thanks for your attention to my cry out.

The steps that I have taken for configuring the Tomcat
5.0.27 can be found in the attachment
'configuration.txt'  

First: I found that I am not the only one having this
problem.  On the forum at the Sun Company's web site,
several people are reporting "exactly" the same error
message regarding the establishing connection pool
connection.  And the version we use is the Tomcat
5.0.27.  See http://java.sun.com/ --> Forums --> JDBC
& JTS      This is the error message we all get:
Cannot create JDBC driver of class '' for connect URL
'null'

Second: There is another exception in the Tomcat logs:
'java.sql.SQLException: open:
java.lang.ClassNotFoundException:
org.gjt.mm.mysql.Driver'

This is a rather weird message.  I am not using the
MySQL driver.  Why the Tomcat is looking for the MySQL
driver?  Maybe it is where my problem stems from? 
Anyway, I am attaching the entire log message in the
Attach Files.

Third: I used to have a DBConnection.java to get a
Connection object from the connection pool (it has
been working well with the Tomct 4.1.18 and MySQL). 
Because this conn = 'null' problem occurred with the
Oracle connection, I followed the advice of another
person and changed the code in the DBConnection.java
to get a better trace of the error message.  I am
posting my code (looking up and get the datasource)
below and those three Java files are also in the
attachment.

Fourth: I have the read and execute permission to the
classes12.jar file.  I right clicked on the
classes12.jar --> properties --> under the Security
tab, I see the permission for both users and my name
specifically for accessing this file.

Fifth: I have tried (downloaded from the Oracle
website today) the classes12.zip (renamed it to
classes12.jar) that is compatible with the Oracle 9i
9.2.0.5, which is the database I am connecting to.  I
have also tried the ojdbc14.jar, which is compatible
with JDK 1.4 and the Oracle 9i 9.2.0.5.  I still get
the same error message: Cannot create JDBC driver of
class '' for connect URL 'null'

DBConnection.java code:

package org.dhsinfo.ConnectionPool;

import java.sql.Connection;
import java.sql.SQLException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class DBConnection
{
  public static Connection getDBConnection() throws
SQLException, NamingException
  {
      InitialContext ctx = new InitialContext();
      DataSource ds = (DataSource)
ctx.lookup("java:comp/env/jdbc/OracleDB");
      return ds.getConnection();
  }
}

OraclePageDAO.java code:

package org.dhsinfo.content.dao;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.SQLException;

import org.dhsinfo.content.PageBean;
import
org.dhsinfo.content.exceptions.PageDAOSysException;
import org.dhsinfo.ConnectionPool.DBConnection;
import javax.naming.*;

public class OraclePageDAO implements PageDAO
{
   // Here the return type is Collection
   public Collection findPages() throws
PageDAOSysException
   {
      Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      PageBean pageBean;
      Collection pages = new ArrayList();
      String query = "SELECT name FROM PersonType";

      try
      {
         conn = DBConnection.getDBConnection();
         stmt = conn.prepareStatement( query );
         rs = stmt.executeQuery();

	 while( rs.next() )
         {
	    pageBean = new PageBean();
            pageBean.setName( rs.getString( "name" )
);
	    pages.add( pageBean );
         }

      }
      catch (NamingException ne)
      {
         ne.printStackTrace();
         throw new PageDAOSysException("SQLException:
" + ne.getMessage());
      }
      catch (SQLException se)
      {
         se.printStackTrace( System.err );
         throw new PageDAOSysException("SQLException:
" + se.getMessage());
      }
      finally
      {
         if ( conn != null )
         {
            try
            {
               rs.close();
               rs = null;
               stmt.close();
               stmt = null;
               conn.close();
            }
            catch( SQLException sqlEx )
            {
               System.out.println( "Problem occurs
while closing " + sqlEx );
            }
            conn = null;
         }
      }
      return pages;
   }
}


--- David Smith <dn...@cornell.edu> wrote:

> First, patience.  If you've been struggling with
> this for a week as you 
> say, a few hours will not kill you.  If it does ....
> well, you should 
> have been asking several days ago.
> 
> Second, are there any exceptions in your logs
> related to the problem 
> below outside the "Cannot create JDBC driver of
> ....."
> 
> Third, please post the segment of code responsible
> for actually doing 
> the lookup and getting a DataSource object.
> 
> Fourth, check your file permissions and be sure
> Tomcat has read access 
> to your class12.jar.
> 
> Lastly, is this the most recent version of the
> Oracle JDBC driver?
> 
> --David
> 
> Caroline Jen wrote:
> 
> >I have been struggling with this problem for more
> than
> >a week. I did follow the JDBC datasource howto. 
> And I
> >posted all the steps that I have taken to configure
> >the Tomcat 5.0.27 connection pool.  Nobody has
> really
> >helped to look into the problem.  Tomcat 5.0.27,
> >j2sdk1.4.2, Oracle 10i, Windows XP
> >
> >I will post all my configuration steps again below
> the
> >error message.  The Tomcat logs file shows:
> >
> >==============================================
> >root cause 
> >
> >org.dhsinfo.content.exceptions.PageDAOSysException:
> >SQLException: Cannot create JDBC driver of class ''
> >for connect URL 'null'
> >
>
>org.dhsinfo.content.dao.OraclePageDAO.findPages(OraclePageDAO.java:51)
> >
>
>org.dhsinfo.content.PageService.getPages(PageService.java:18)
> >
>
>org.dhsinfo.content.SelectPage.execute(SelectPage.java:29)
> >=================================================
> >The configuration steps that I have taken are
> listed
> >below:
> >
> >Step 1. 
> >
> >Jakarta-Commons DBCP 1.2.1 
> >Jakarta-Commons Collections 2.1.1 
> >Jakarta-Commons Pool 1.2
> > 
> >These jar files are installed in 
> >$CATALINA_HOME/common/lib. 
> >
> >Step 2.
> >download classes12.zip rename it to classes12.jar
> and
> >place it in 
> >TOMCAT_HOME\common\lib
> >
> >Step 3. C:\jakarta-tomcat-5.0.27\conf\server.xml
> >configuration
> >I did put the driver and URL in the
> >C:\jakarta-tomcat-5.0.27\conf\server.xml file (The
> >code shown below is inserted between
> >the         <Logger
> >className="org.apache.catalina.logger.FileLogger"
> >directory="logs"  prefix="localhost_log."
> >suffix=".txt" timestamp="true"/> and the
> >closing </Host> tag).  
> >
> ><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/OracleDB" auth="Container"
> >             type="javax.sql.DataSource"/> 
> >
> >   <ResourceParams name="jdbc/OracleDB">
> >      <parameter>
> >         <name>factory</name>
> >        
>
><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> >      </parameter>
> >      <parameter>
> >         <name>maxWait</name>
> >         <value>5000</value>
> >      </parameter>
> >      <parameter>
> >         <name>maxActive</name>
> >         <value>20</value>
> >      </parameter>
> >      <parameter>
> >         <name>password</name>
> >         <value>cmis001</value>
> >      </parameter>
> >      <parameter>
> >         <name>url</name>
> >        
>
><value>jdbc:oracle:thin:@172.19.47.22:1521:devora2</value>
> >      </parameter>
> >      <parameter>
> >         <name>driverClassName</name>
> >        
> ><value>oracle.jdbc.driver.OracleDriver</value>
> >      </parameter>
> >      <parameter>
> >         <name>maxIdle</name>
> >         <value>10</value>
> >      </parameter>
> >      <parameter>
> >         <name>username</name>
> >         <value>cmis</value>
> >      </parameter>
> >      <parameter>
> >         <name>removeAbandoned</name>
> >         <value>true</value>
> >      </parameter>
> >      <parameter>
> >         <name>removeAbandonedTimeout</name>
> >         <value>60</value>
> >      </parameter>
> >      <parameter>
> >         <name>logAbandoned</name>
> >         <value>true</value>
> >      </parameter>
> ></ResourceParams>
> ></Context>
> >
> >Step 4. web.xml Configuration (the one in
> >MyApp/WEB-INF directory)
> >
> >add these lines after the <taglib> element
> >
> >**********************
> ><resource-ref>
> > <description>Oracle Datasource</description>
> > <res-ref-name>jdbc/OracleDB</res-ref-name>
> > <res-type>javax.sql.DataSource</res-type>
> > <res-auth>Container</res-auth>
> ></resource-ref>
> >**********************
> >
> >--- Peng Tuck Kwok <pe...@gmail.com> wrote:
> >
> >  
> >
> >>On Tue, 14 Sep 2004 13:56:48 -0700 (PDT), Caroline
> >>Jen
> >><ji...@yahoo.com> wrote:
> >>
> >>    
> >>
> >>>When I configured the Tomcat 5.0.27, I did put
> the
> >>>driver and URL in the
> >>>C:\jakarta-tomcat-5.0.27\conf\server.xml file
> (The
> >>>      
> >>>
> >>That's great, but did you actually put the driver
> in
> >>a location that
> >>tomcat could find it  ?
> >>Like here: $CATALINA_HOME/common/lib ?  Dump your
> >>driver there (make
> >>sure it's a jar file),
> >>restart tomcat. Check out the jdbc datasource
> howto
> >>if you've missed
> >>anything else.
> >>
> >>
> >>    
> >>
>
>---------------------------------------------------------------------
> >  
> >
> >>To unsubscribe, e-mail:
> >>tomcat-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail:
> >>tomcat-user-help@jakarta.apache.org
> >>
> >>
> 
=== message truncated ===




		
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail