Marc,

I have read this, and your excellent howto,

http://marc.theaimsgroup.com/?l=tomcat-user&m=102225547106556&w=2

and I am still having a problem at the startup of the tomcat server. The 
JNDI service is failing before I even get a chance to test it....

my server.xml  and JNDI naming is pretty much the same (I think)

<!--  the data source added by Clay-->
<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>100</value></parameter>
      <parameter><name>maxIdle</name><value>30000</value></parameter>
      <parameter><name>maxWait</name><value>100</value></parameter>


      <parameter><name>username</name><value>tomcat</value></parameter>
      <parameter><name>password</name><value>password</value></parameter>

     <parameter>
       <name>driverClassName</name><value>org.gjt.mm.mysql.Driver</value>
     </parameter>

    <parameter>
      <name>url</name><value>jdbc:mysql://localhost:3306/test</value>
    </parameter>
  </ResourceParams>
</Context>

<!--  end data source -->

in my $CATALINA_HOME/comm/lib/ the following jars exist:

[root@meis lib]# ls -al|grep commons
-rw-r--r--    1 root     root        90489 Jun  1 00:55 
commons-collections.jar
-rw-r--r--    1 root     root        25451 Jun  1 00:55 commons-dbcp.jar
-rw-r--r--    1 root     root        22840 Jun  1 00:55 commons-logging.jar
-rw-r--r--    1 root     root        28841 Jun  1 00:55 commons-pool.jar
[root@meis lib]# ls -al|grep my
-rw-rw-r--    1 root     root       125901 Jun 30 21:52 
mm.mysql-2.0.14-bin.jar

I know the port is correct:

[root@meis test]# mysqladmin --print-defaults
mysqladmin would have been started with the following arguments:
--port=3306 --host=localhost

but when I start tomcat and look at the log for the JNDI service:

[root@meis logs]# tail -f localhost_DBTest_log.2002-07-08.txt
2002-07-08 11:07:06 StandardContext[/DBTest]: Starting
2002-07-08 11:07:06 StandardContext[/DBTest]: Processing start(), current 
available=false
2002-07-08 11:07:06 StandardContext[/DBTest]: Configuring default Resources

This isn't enough information for me to figure out what the problem may be, 
I know alot of people just download the latest version of everything and 
hope that works but I would like to know why this is failing....

any help would help!

clay




-----Original Message-----
From:   Marc Logemann [SMTP:[EMAIL PROTECTED]]
Sent:   Tuesday, July 02, 2002 5:35 AM
To:     [EMAIL PROTECTED]
Subject:        plain MySQL DataSource in Tomcat (i know, damn topic)

Hi,

i am one of the guys trying to get a valid MysqlDataSource reference via
JNDI. But i am getting crazy without knowing where the problem is (perhaps
the reason is, i cant debug JNDI too good, cause i am no expert in it..)

i have the following:

server.xml
----------
<context ....>
<Resource name="jdbc/TestDB" auth="Cotainer" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
    <parameter>
        <name>factory</name>
 
       <value>org.gjt.mm.mysql.jdbc2.optional.MysqlDataSourceFactory</va  
lue>
      </parameter>
<parameter> <name>user</name><value>root</value> </parameter>
<parameter> <name>password</name><value></value> </parameter>
<parameter> 
<name>driverClassName</name><value>org.gjt.mm.mysql.jdbc2.optional.Mysql  
DataSource</value></parameter>
<parameter> 
<name>driverName</name><value>jdbc:mysql://localhost/maxbahr</value> 
</parameter>
</ResourceParams>
</context>

web.xml
-------
<web-app>
<resource-ref>
  <description>DataSource MySQL</description>
  <res-ref-name>jdbc/TestDB</res-ref-name>
  <res-type> javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>
</web-app>

i placed the mysql mm jar into commons/lib

When i run a servlet with the standard lookup code:
     try {
         javax.naming.Context jndictx = new InitialContext();
         if (jndictx == null) throw new Exception("Boom - No Context");

         DataSource ds =
                 (DataSource) jndictx.lookup("java:comp/env/jdbc/TestDB");
         if (ds != null) {
[..]

i get no exception but i also dont get any reference returned from lookup.

I read tons of websites including the tomcat JNDI howto, without beeing 
able to understand it
better (in fact it gets worse cause of thousands of combinations in the web 
for server.xml and
web.xml)

When i leave out factory in the server.xml, i get a tyrex exception 
regarding loading a factory...

I just thought that using a datasource is better than just calling the 
DriverManager, but the
effort seems amazing... or i am too unclever... whatever...

thx for help.
---
greetings from
Marc Logemann
Homebase @ www.logemann.info


--
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]>

Reply via email to