You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Conrad Wood <cn...@conradwood.net> on 2002/02/06 18:37:15 UTC

coccon2: mm.mysql is not invoked when I use esql:pool, but works in jsp:...

I'm a little bit troubled here with cocoon-2 (+tomcat)
I am unable to load the mysql jdbc driver in cocoon
via the web.xml. (in jsp I can load it, but not
when using pools in esql)
So here it goes:

I seem to be able to use the mm.mysql jdbc driver
when I use jsp in cocoon like so:
======
Class.forName("org.gjt.mm.mysql.Driver");
 java.sql.Connection con =
  java.sql.DriverManager.getConnection
     ("jdbc:mysql://stella/mysql?user=.&password=..")
======
   and so forth.
I guess, That means my class is where cocoon can find it, right?

now trying to do the same in xsl (esql):
====
<esql:connection>
<esql:pool>mysqlconn</esql:pool>
<esql:execute-query>
<esql:query>Select * from EMP</esql:query>
======
fails with the annoying no suitable driver found error.

What I have sone so far:

I edited cocoon/WEB-INF/web.xml:
=======
  <init-param>
   <param-name>load-class</param-name>
   <param-value>org.gjt.mm.mysql.Driver</param-value>
  </init-param>
======
and thought this should load mysql driver class, right?

I went on to define my connection in cocoon.xconf:
=========
<datasources>
 <jdbc name="mysqlconn" logger="core.datasources.mysqlconn">
  <pool-controller min="5" max="10"/>
   <auto-commit>true</auto-commit>
   <dburl>jdbc:mysql:stella:3306:mysql</dburl>
     <!--
       <dburl>jdbc:mysql://stella:3306/teapop</dburl>
       <dburl>jdbc:mysql://stella/mysql:3306/mysql</dburl>
      -->
     <user>root</user>
     <password>ssshh</password>
  </jdbc>
  ... more datasources
==========
the commented out ones I tried too but they fail the same way.

I then went into my sitemap to give me a little playarea:
=============
 <map:pipeline>
   <map:match pattern="conrad/*.xsp">
   <map:generate type="serverpages" src="conrad/{1}.xsp"/>
   <map:serialize type="html"/>
    </map:match>
  </map:pipeline>
================

And I get:
org.apache.cocoon.ProcessingException: Exception in
ServerPagesGenerator.generate(): java.lang.RuntimeException: Could not
get the datasource
org.apache.avalon.excalibur.datasource.NoAvailableConnectionException:
There are no connections in the pool, check your settings.

further up in the logs when it tries to initialize mysqlconn,
I get several lines like:

core.log.000001-DEBUG   (2002-02-06) 17:23.02:655 [core] (Unknown-URI) Unknown-thread/DefaultComponentFactory: logger attribute is core.datasources.mysqlconn
core.log.000001-DEBUG   (2002-02-06) 17:23.02:738 [core.datasources.mysqlconn] (Unknown-URI) Unknown-thread/LogKitLogger: factory created class was null so a new instance could not be created.
core.log.000001:java.sql.SQLException: No suitable driver
core.log.000001-        at
java.sql.DriverManager.getConnection(DriverManager.java:537)
core.log.000001-        at
java.sql.DriverManager.getConnection(DriverManager.java:177)
============

the mysql..-bin.jar is in cocoon/WEB-INF/lib
the xsp in cocoon/conrad/test3.xsp
the web-xml in cocoon/WEB-INF/
the cocoon.xconf in cocoon/


Is my dburl wrong? what should it be?
Is it not loading the driver for some other reason? why? ;(

Thanks, Conrad.



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>