Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-29 Thread stevem

After reading something in another post this morning I realized I was
mixing instructions from the 4.1 JNDI How-to.  I've reposted this message
with updated information after making sure I was ONLY following the 4.0
JNDI How to.

I have deleted my server.xml and started with a fresh copy.  First, I made
sure I could connect to MySQL with a regular JDBC connection.  Next, I
added a JDBC Realm using MySQL.  That works fine.  Finally, I added a JDBC
resource and tried to use it.  That is when I get the error below.

The error I have, and have always had, even before the 4.1 detour, is the
following:

javax.naming.NamingException: Exception creating DataSource:
org.hsql.jdbcDriver
 at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
 at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
 at javax.naming.InitialContext.lookup(InitialContext.java:351)
 at foo.DBTest1.init(DBTest1.java:19)
 at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)

Why would Tomcat be looking for a Hypersonic SQL driver?  I took a shot and
copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no effect
I removed it.

I'm currently running
Windows 2000
J2SE 1.4.0
J2SE 1.3.1
Tomcat 4.04
MySQL 4.0.2-Alpha
MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to
$TOMCAT_HOME/common/lib,)

I get the same error no matter what code I run.  For example, Both code
blocks below result in the same error:
 Context ctx = new InitialContext();
 ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
  "com.sun.jndi.fscontext.RefFSContextFactory");
 Connection conn = ds.getConnection();
 if(ctx == null )
  throw new Exception("Boom - No Context");
 DataSource ds = (DataSource)ctx.lookup(
  "java:comp/env/jdbc/TestDB");   <-- Blows up here
--- AND ---
  Context initCtx = new InitialContext();
  Context envCtx = (Context) initCtx.lookup("java:comp/env");
  if(envCtx == null )
  throw new Exception("Boom - No Context");
  DataSource ds =
  (DataSource)envCtx.lookup("jdbc/TestDB");  <--- Blows up here

I added the following to the web.xml file:

  DB Connection
 jdbc/TestDB
 javax.sql.DataSource
 Container


Here is my server.xml file:


  




  
  
  
  
  









 
   
  

  




  

  
  

  factory

org.apache.commons.dbcp.BasicDataSourceFactory


  maxActive
  100


  maxIdle
  3


  maxWait
  100


 username
 javauser


 password
 javadude



   driverClassName
   org.gjt.mm.mysql.Driver



  url
  jdbc:mysql://localhost:3306/javatest

  
 
  



  

 
  






  
  

  
  



  



Any ideas?

Steve Mitchell
e-Business Architect/Developer
Integrated Corporate Solutions, Inc.
913-685-6506
[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-29 Thread Vance Christiaanse

Steve,

I'm stuck in a similar situation. Here's one thing I noticed about your
server.xml file:

The 4.1 JNDI How-to uses a parameter name of "url" for the URL but the 4.0
JNDI How-to uses a parameter name of "driverName" for the URL.

Your server.xml file is using "url" for the parameter name but you're trying
to use 4.0.

I don't know if this is significant or not.

Vance

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Thursday, August 29, 2002 10:31 AM
Subject: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL


> After reading something in another post this morning I realized I was
> mixing instructions from the 4.1 JNDI How-to.  I've reposted this message
> with updated information after making sure I was ONLY following the 4.0
> JNDI How to.
>
> I have deleted my server.xml and started with a fresh copy.  First, I made
> sure I could connect to MySQL with a regular JDBC connection.  Next, I
> added a JDBC Realm using MySQL.  That works fine.  Finally, I added a JDBC
> resource and tried to use it.  That is when I get the error below.
>
> The error I have, and have always had, even before the 4.1 detour, is the
> following:
>
> javax.naming.NamingException: Exception creating DataSource:
> org.hsql.jdbcDriver
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
>  at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
>  at javax.naming.InitialContext.lookup(InitialContext.java:351)
>  at foo.DBTest1.init(DBTest1.java:19)
>  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)
>
> Why would Tomcat be looking for a Hypersonic SQL driver?  I took a shot
and
> copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no
effect
> I removed it.
>
> I'm currently running
> Windows 2000
> J2SE 1.4.0
> J2SE 1.3.1
> Tomcat 4.04
> MySQL 4.0.2-Alpha
> MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to
> $TOMCAT_HOME/common/lib,)
>
> I get the same error no matter what code I run.  For example, Both code
> blocks below result in the same error:
>  Context ctx = new InitialContext();
>  ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
>   "com.sun.jndi.fscontext.RefFSContextFactory");
>  Connection conn = ds.getConnection();
>  if(ctx == null )
>   throw new Exception("Boom - No Context");
>  DataSource ds = (DataSource)ctx.lookup(
>   "java:comp/env/jdbc/TestDB");   <-- Blows up here
> --- AND ---
>   Context initCtx = new InitialContext();
>   Context envCtx = (Context) initCtx.lookup("java:comp/env");
>   if(envCtx == null )
>   throw new Exception("Boom - No Context");
>   DataSource ds =
>   (DataSource)envCtx.lookup("jdbc/TestDB");  <--- Blows up here
>
> I added the following to the web.xml file:
> 
>   DB Connection
>  jdbc/TestDB
>  javax.sql.DataSource
>  Container
> 
>
> Here is my server.xml file:
>
> 
>   
> 
> port="8080" minProcessors="5" maxProcessors="75"
>enableLookups="true" redirectPort="8443"
>acceptCount="10" debug="0" connectionTimeout="6"/>
> 
> 
>   
>  prefix="catalina_log." suffix=".txt"
>   timestamp="true"/>
> driverName="org.gjt.mm.mysql.Driver"
>   connectionURL
> ="jdbc:mysql://localhost/authority?user=javauser;password=javadude"
>   userTable="users" userNameCol="user_name" userCredCol
> ="user_pass"
>   userRoleTable="user_roles" roleNameCol="role_name" />
>   
>   
>   directory="logs"  prefix="localhost_access_log." suffix
> =".txt"
>  pattern="common"/>
>   

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-29 Thread stevem


Vance,

Good eye.  It use to be driverName but got changed along the way to URL.
Probably when I started following the 4.1 how-to.  In any case, I changed
back to driverName and, alas, same problem.

Vance, do you get the same error?

javax.naming.NamingException: Exception creating DataSource:
org.hsql.jdbcDriver
 at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
 at foo.DBTest1.init(DBTest1.java:20)
 at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)




   
   "Vance  
   Christiaanse"   
   <[EMAIL PROTECTED]   To 
   com>  "Tomcat Users List"   
 <[EMAIL PROTECTED]>  
   08/29/2002 11:16 cc 
   AM  
   Subject 
 Re: Trouble configuring Tomcat 4.0.4  
   Please respond to JNDI connection to MySQL  
 "Tomcat Users 
 List" 
   
   
   




Steve,

I'm stuck in a similar situation. Here's one thing I noticed about your
server.xml file:

The 4.1 JNDI How-to uses a parameter name of "url" for the URL but the 4.0
JNDI How-to uses a parameter name of "driverName" for the URL.

Your server.xml file is using "url" for the parameter name but you're
trying
to use 4.0.

I don't know if this is significant or not.

Vance

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Thursday, August 29, 2002 10:31 AM
Subject: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL


> After reading something in another post this morning I realized I was
> mixing instructions from the 4.1 JNDI How-to.  I've reposted this message
> with updated information after making sure I was ONLY following the 4.0
> JNDI How to.
>
> I have deleted my server.xml and started with a fresh copy.  First, I
made
> sure I could connect to MySQL with a regular JDBC connection.  Next, I
> added a JDBC Realm using MySQL.  That works fine.  Finally, I added a
JDBC
> resource and tried to use it.  That is when I get the error below.
>
> The error I have, and have always had, even before the 4.1 detour, is the
> following:
>
> javax.naming.NamingException: Exception creating DataSource:
> org.hsql.jdbcDriver
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
>  at
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
>  at javax.naming.InitialContext.lookup(InitialContext.java:351)
>  at foo.DBTest1.init(DBTest1.java:19)
>  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)
>
> Why would Tomcat be looking for a Hypersonic SQL driver?  I took a shot
and
> copied Hypersonic 1.61 hsqldb.jar to /common/lib, but when it had no
effect
> I removed it.
>
> I'm currently running
> Windows 2000
> J2SE 1.4.0
> J2SE 1.3.1
> Tomcat 4.04
> MySQL 4.0.2-Alpha
> MySQL Connector 2.0.14. (I copied mysql-connector-java-2.0.14-bin.jar to
> $TOMCAT_HOME/common/lib,)
>
> I get the same error no matter what code I run.  For example, Both code
> blocks below result in the same error:
>  Context ctx = new InitialContext();
>  ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
>   "com.sun.jndi.fscontext.RefFSContextFactory");
>

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread Martin Jacobson

[EMAIL PROTECTED] wrote:

> Vance,
> 
> Good eye.  It use to be driverName but got changed along the way to URL.
> Probably when I started following the 4.1 how-to.  In any case, I changed
> back to driverName and, alas, same problem.
> 
> Vance, do you get the same error?
> 
> javax.naming.NamingException: Exception creating DataSource:
> org.hsql.jdbcDriver
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
>  at foo.DBTest1.init(DBTest1.java:20)
>  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)
> 


Hi, I had this problem for ages, and resolved it by retrofitting the 
DataSource factory (& connection pool) from tc4.1. The basic problem is 
that Tyrex is broken; it happened to work for some people, but not for 
me and many others :-(

At this point, Craig will probably come in and say to move to tc 4.1, 
and I'd say, 'fine, as long as you don't use SSL with a standalone 
tomcat, because the Coyote connector is broken in this respect.'

What you can do is download 4.1.9, remove tyrex...jar from common/lib in 
4.0.4, and drop in the commons-*.jar files from 4.1.

Here is what I have in /usr/local/tomcat/common/lib
activation.jar
commons-collections.jar
commons-dbcp.jar
commons-pool.jar
jdbc2_0-stdext.jar
jndi.jar
jta-spec1_0_1.jar
mail.jar
mm.mysql-2.0.14-bin.jar
naming-common.jar
naming-factory.jar
naming-resources.jar
servlet.jar
xerces.jar

HTH
Martin

PS: dont forget that the  parameter is  with DBCP



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread stevem


Martin,

You are using mm.mysql-2.0.14-bin.jar.  I am using
mysql-connector-java-2.0.14-bin.jar from the MySQL Connector/J2 download.
Do know if there is any difference or was the name just changed when it
became the official driver of MySQL?





.  Where did your driver come from?


   
   Martin Jacobson 
   <[EMAIL PROTECTED]  
   t>   To 
 Tomcat Users List 
   08/30/2002 06:01  <[EMAIL PROTECTED]>  
   AM   cc 
   
   Subject 
   Please respond to Re: Trouble configuring Tomcat 4.0.4  
 "Tomcat Users   JNDI connection to MySQL  
 List" 
   
   
   
   




[EMAIL PROTECTED] wrote:

> Vance,
>
> Good eye.  It use to be driverName but got changed along the way to URL.
> Probably when I started following the 4.1 how-to.  In any case, I changed
> back to driverName and, alas, same problem.
>
> Vance, do you get the same error?
>
> javax.naming.NamingException: Exception creating DataSource:
> org.hsql.jdbcDriver
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
>  at foo.DBTest1.init(DBTest1.java:20)
>  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)
>


Hi, I had this problem for ages, and resolved it by retrofitting the
DataSource factory (& connection pool) from tc4.1. The basic problem is
that Tyrex is broken; it happened to work for some people, but not for
me and many others :-(

At this point, Craig will probably come in and say to move to tc 4.1,
and I'd say, 'fine, as long as you don't use SSL with a standalone
tomcat, because the Coyote connector is broken in this respect.'

What you can do is download 4.1.9, remove tyrex...jar from common/lib in
4.0.4, and drop in the commons-*.jar files from 4.1.

Here is what I have in /usr/local/tomcat/common/lib
activation.jar
commons-collections.jar
commons-dbcp.jar
commons-pool.jar
jdbc2_0-stdext.jar
jndi.jar
jta-spec1_0_1.jar
mail.jar
mm.mysql-2.0.14-bin.jar
naming-common.jar
naming-factory.jar
naming-resources.jar
servlet.jar
xerces.jar

HTH
Martin

PS: dont forget that the  parameter is  with DBCP



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





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread stevem


Martin's advice made a difference.  When I pulled in the tc 4.1 common/lib
jars to my tc 4.04 common/lib I got past my problem for the first time.
The new contents of common/lib are: activation.jar,
commons-collections.jar, commons-dbcp.jar, commons-pool.jar,
jdbc2_0-stdext.jar, jndi.jar, jta-spec1_0_1.jar, mail.jar,
mysql-connector-java-2.0.14-bin.jar, naming-common.jar, naming-factory.jar,
naming-resources.jar, servlet.jar, tools.jar, xerces.jar.

Now I have a new problem which hopefully is easy to correct:

java.sql.SQLException: Cannot load JDBC driver class 'null'
 at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
 at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
 at foo.DBTest.init(DBTest.java:32)

I've tried setting driverName to  com.mysql.jdbc.Driver,
org.gjt.mm.mysql.Driver, and even to
com.mysql.jdbc.jdbc2.optional.MysqlDataSource. I also tried adding
Class.forName(...).newInstance() to my code, but it was no help either.

Here is my code:
Class.forName("com.mysql.jdbc.Driver").newInstance();
Context ctx = new InitialContext();
  ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
   "org.apache.naming.factory.DbcpDataSourceFactory");
//"com.sun.jndi.fscontext.RefFSContextFactory");
  if(ctx == null )throw new Exception("Boom - No Context");
  DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
  if (ds != null) {
Connection conn = ds.getConnection();   <--- Blows
up here

Here is my host/context:
...










 
   
  

  




  

  
  

  factory

org.apache.commons.dbcp.BasicDataSourceFactory


  maxActive
  100


  maxIdle
  3


  maxWait
  100


 username
 javauser


 password
 javadude


   driverClassName
 

   com.mysql.jdbc.Driver


  driverName
  jdbc:mysql://localhost:3306/javatest

  
 
  

  

Any thoughts?

Steve



   
   Martin Jacobson 
   <[EMAIL PROTECTED]  
   t>   To 
 Tomcat Users List 
   08/30/2002 06:01  <[EMAIL PROTECTED]>  
   AM   cc 
   
   Subject 
   Please respond to Re: Trouble configuring Tomcat 4.0.4  
 "Tomcat Users   JNDI connection to MySQL  
 List" 
   
   
   
   




[EMAIL PROTECTED] wrote:

> Vance,
>
> Good eye.  It use to be driverName but got changed along the way to URL.
> Probably when I started following the 4.1 how-to.  In any case, I changed
> back to driverName and, alas, same problem.
>
> Vance, do you get the same error?
>
> javax.naming.NamingException: Exception creating DataSource:
> org.hsql.jdbcDriver
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
>  at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
>  at foo.DBTest1.init(DBTest1.java:20)
>  at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60)
>


Hi, I had this problem for ages, and resolved it by retrofitting the
DataSource factory (& connection pool) from tc4.1. The basic problem is
that Tyrex is broken; it happened to work for some people, but not for
me and many others :-(

At this point, Craig will probably come in and say to move to tc 4.1,
and I'd say, 'fine, as long as you don't use SSL with a

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread Craig R. McClanahan



On Fri, 30 Aug 2002, Martin Jacobson wrote:

>
> At this point, Craig will probably come in and say to move to tc 4.1,
> and I'd say, 'fine, as long as you don't use SSL with a standalone
> tomcat, because the Coyote connector is broken in this respect.'
>

I hope you've reported your issues to the bug tracking system -- we're
trying to get a stable release out the door, and any real problems with
SSL support would be pretty significant.

  http://nagoya.apache.org/bugzilla/


Craig


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread Vance Christiaanse

You need to set "driverClassName" to the proper value,
com.mysql.jdbc.Driver, not "driverName".

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Cc: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 30, 2002 12:20 PM
Subject: Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL


>
> Martin's advice made a difference.  When I pulled in the tc 4.1 common/lib
> jars to my tc 4.04 common/lib I got past my problem for the first time.
> The new contents of common/lib are: activation.jar,
> commons-collections.jar, commons-dbcp.jar, commons-pool.jar,
> jdbc2_0-stdext.jar, jndi.jar, jta-spec1_0_1.jar, mail.jar,
> mysql-connector-java-2.0.14-bin.jar, naming-common.jar,
naming-factory.jar,
> naming-resources.jar, servlet.jar, tools.jar, xerces.jar.
>
> Now I have a new problem which hopefully is easy to correct:
>
> 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 foo.DBTest.init(DBTest.java:32)
>
> I've tried setting driverName to  com.mysql.jdbc.Driver,
> org.gjt.mm.mysql.Driver, and even to
> com.mysql.jdbc.jdbc2.optional.MysqlDataSource. I also tried adding
> Class.forName(...).newInstance() to my code, but it was no help either.
>
> Here is my code:
> Class.forName("com.mysql.jdbc.Driver").newInstance();
> Context ctx = new InitialContext();
>   ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
>"org.apache.naming.factory.DbcpDataSourceFactory");
> //"com.sun.jndi.fscontext.RefFSContextFactory");
>   if(ctx == null )throw new Exception("Boom - No Context");
>   DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
>   if (ds != null) {
> Connection conn = ds.getConnection();   <--- Blows
> up here
>
> Here is my host/context:
> ...
> 
>   directory="logs"  prefix="localhost_access_log." suffix
> =".txt"
>  pattern="common"/>
>   directory="logs"  prefix="localhost_log." suffix=".txt"
>  timestamp="true"/>
> 
> 
>
> 
>   debug="0" privileged="true"/>
>
> 
> reloadable="true" crossContext="true">
>   prefix="localhost_examples_log." suffix=".txt"
> timestamp="true"/>
>="org.apache.catalina.session.PersistentManager"
>   debug="0"
>   saveOnRestart="true"
>   maxActiveSessions="-1"
>   minIdleSwap="-1"
>   maxIdleSwap="-1"
>   maxIdleBackup="-1">
> 
>   
> 
> 
>  debug="5" reloadable="true" crossContext="true">
>
> prefix="localhost_DBTest_log." suffix=".txt"
>  timestamp="true"/>
>
>   auth="Container"
>type="javax.sql.DataSource"/>
>   
> 
>   factory
>
> org.apache.commons.dbcp.BasicDataSourceFactory
> 
> 
>   maxActive
>   100
> 
> 
>   maxIdle
>   3
> 
> 
>   maxWait
>   100
> 
> 
>  username
>  javauser
> 
> 
>  password
>  javadude
> 
> 
>driverClassName
>  
> 
>com.mysql.jdbc.Driver
> 
> 
>   driverName
>   jdbc:mysql://localhost:3306/javatest
> 
>   
>  
>   
> 
>   
>
> Any thoughts?
>
> Steve

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL

2002-08-30 Thread stevem


Thanks, Vance.  Actually, the parameter above that is "driverClassName"
the one you are looking at use to be "url", but in some server.xml files
the second parameter is "driverName" instead of "url".

If you look at the 4.0 JNDI how-to it uses the "driverName" parameter below
"driverClassName"; however, in the 4.1 JNDI how-to it used "url" after the
driverClassName.  Maybe the 4.0 how-to has an error in it.

I found the bug, I think, after I uninstalled 4.0.4 and install 4.1.9.  My
closing tag was "" instead of ".  For some reason 4.0.4
did not complain about it (or else I missed the message).

Now, I have another learning issue with the 4.1.9 manager.  I'll cover that
in a new thread.



   
   "Vance  
   Christiaanse"   
   <[EMAIL PROTECTED]   To 
   com>  "Tomcat Users List"   
 <[EMAIL PROTECTED]>  
   08/30/2002 02:34 cc 
   PM  
   Subject 
 Re: Trouble configuring Tomcat 4.0.4  
   Please respond to JNDI connection to MySQL  
 "Tomcat Users 
 List" 
   
   
   




You need to set "driverClassName" to the proper value,
com.mysql.jdbc.Driver, not "driverName".

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Cc: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 30, 2002 12:20 PM
Subject: Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL


>
> Martin's advice made a difference.  When I pulled in the tc 4.1
common/lib
> jars to my tc 4.04 common/lib I got past my problem for the first time.
> The new contents of common/lib are: activation.jar,
> commons-collections.jar, commons-dbcp.jar, commons-pool.jar,
> jdbc2_0-stdext.jar, jndi.jar, jta-spec1_0_1.jar, mail.jar,
> mysql-connector-java-2.0.14-bin.jar, naming-common.jar,
naming-factory.jar,
> naming-resources.jar, servlet.jar, tools.jar, xerces.jar.
>
> Now I have a new problem which hopefully is easy to correct:
>
> 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 foo.DBTest.init(DBTest.java:32)
>
> I've tried setting driverName to  com.mysql.jdbc.Driver,
> org.gjt.mm.mysql.Driver, and even to
> com.mysql.jdbc.jdbc2.optional.MysqlDataSource. I also tried adding
> Class.forName(...).newInstance() to my code, but it was no help either.
>
> Here is my code:
> Class.forName("com.mysql.jdbc.Driver").newInstance();
> Context ctx = new InitialContext();
>   ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY,
>"org.apache.naming.factory.DbcpDataSourceFactory");
> //"com.sun.jndi.fscontext.RefFSContextFactory");
>   if(ctx == null )throw new Exception("Boom - No Context");
>   DataSource ds = (DataSource)ctx.lookup
("java:comp/env/jdbc/TestDB");
>   if (ds != null) {
> Connection conn = ds.getConnection();   <---
Blows
> up here
>
> Here is my host/context:
> ...
> 
>   directory="logs"  prefix="localhost_access_log." suffix
> =".txt"
>  pattern="common"/>
>   directory="logs"  prefix="localhost_log." suffix=".txt"
>  timestamp="true"/>
> 
> 
>
> 
>   debug="0" privileged="true"/>
>
> 
> reloadable="true" crossContext="true">
>   prefix="localhost_examples_log." suffix=".txt&quo

Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL ***PROBLEMSOLVED***

2002-08-30 Thread stevem


Thank you to everyone who helped with this.  I am now able to use a JNDI
MySQL DataSource.

The last problem I had, after moving to 4.1.9, was caused by a typo in my
closing  tag.

I do not know if that was the problem all along with 4.0.4.




--
To unsubscribe, e-mail:   
For additional commands, e-mail: