You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by sameer nanda <sa...@rediffmail.com> on 2004/05/07 18:38:33 UTC

Problem Intergrating Cocoon2.1.2 & MySQL 3.23.58

Hello Everybody ....

I am having problems with integrating my application using Cocoon 2.1.2 and MySQL 3.23.58. I read a lot of questionaries realted to this topic
but could not find anything reletaing to the problem I am having .  lets start with the environment in which I am working.

System Specification:
-------------------------
1) Cocoon 2.1.2
-> downloaded the latest source version and installed using
   1) Building cocoon using "build"
   2) Running cocoon using "./cocoon.sh cli"
   3) http://ip-add:8888  points to the welcome page of cocoon


2) MySQL 3.23.58
3) JDK 1.4.0
4) Apache 2.0.43
5) Tomcat 4.0.4b1

Following is the step by step procedure I followed trying to build an application to access database:

Steps:
--------
1)  copy the driver jar ( mm.mysql-2.0.13-bin.jar) file in  cocoon-context:/build/webapp/WEB-INF/lib

2) Defined a MySQL datasource in web.xml
   <init-param>
      <param-name>load-class</param-name>
      <param-value>
        <!-- For parent ComponentManager sample: -->
        org.apache.cocoon.samples.parentcm.Configurator
        <!-- For IBM WebSphere: -->
        com.ibm.servlet.classloader.Handler

        <!-- For HSQLDB Database Driver: -->
        org.hsqldb.jdbcDriver

        <!-- For MYSQL Database Driver (included by me) -->
        org.gjt.mm.mysql.Driver

</param-value>
    </init-param>

3) Add a connection to MySQL in cocoon.xconf
<jdbc logger="core.datasources.adhportal" name="adhportal">
        <pool-controller max="10" min="5"/>
        <dburl>jdbc:mysql://portal.cis.umassd.edu/adh</dburl>
        <user>adh</user>
        <password>password</password>
    </jdbc>

4) Include pipeline in sitemap.xmap
<map:match pattern="sqldocument">
                <map:generate src="sql/sqlexample.xml"/>
                <map:transform type="sql">
                        <map:parameter name="use-connection" value="adhportal"/>
                </map:transform>
                <map:transform type="log">
                        <map:parameter name="logfile" value="logfile.log"/>
                        <map:parameter name="append" value="no"/>
                </map:transform>
                <map:transform src="sql/sqlexample.xsl"/>
                <map:serialize type="xml"/>
        </map:match>


5) XML file looks like this:
<?xml version="1.0"?>
<document>
        <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
                <sql:use-connection>adhportal</sql:use-connection>
                <sql:query>
                        select * from emp
                </sql:query>
        </sql:execute-query>
</document>


6) XSL looks something like this:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="http://apache.org/cocoon/SQL/2.0">

<xsl:template match="document">
        <html><body><table>
                <xsl:apply-templates select="sql:rowset/sql:row"/>
        </table></body></html>
</xsl:template>

<xsl:template match="sql:row">
        <tr>
                <xsl:apply-templates/>
        </tr>
</xsl:template>

<xsl:template match="sql:empNo">
        <td>
                <xsl:value-of select="."/>
        </td>
</xsl:template>

<xsl:template match="sql:empName">
        <td>
                <xsl:value-of select="."/>
        </td>
</xsl:template>

<xsl:template match="sql:empSal">
        <td>
                <xsl:value-of select="."/>
        </td>
</xsl:template>

</xsl:stylesheet>



But insted of the expected outout in the form of Rows fetched from the table ,  I get a blank page, and following is the message
I get in the logfile.log file :

================================================================================================

[[setup] ---------------------------- [Fri May 07 12:32:09 EDT 2004] ----------------------------
[setDocumentLocator] systemid=file:/home/g_snanda/cocoon-2.1.2/build/webapp/sql/sqlexample.xml,publicid=null
[startDocument]
[startElement] uri=,local=document,raw=document
[characters]

[startPrefixMapping] prefix=sql,uri=http://apache.org/cocoon/SQL/2.0
[characters]

[characters]

[characters]

[startPrefixMapping] prefix=,uri=http://apache.org/cocoon/SQL/2.0
[startElement] uri=http://apache.org/cocoon/SQL/2.0,local=rowset,raw=rowset
[startElement] uri=http://apache.org/cocoon/SQL/2.0,local=error,raw=error
[characters] Failed to obtain connection. Made 5 attempts with 5000ms interval
[endElement] uri=http://apache.org/cocoon/SQL/2.0,local=error,qname=error
[endElement] uri=http://apache.org/cocoon/SQL/2.0,local=rowset,qname=rowset
[endPrefixMapping] prefix=
[endPrefixMapping] prefix=sql
[characters]

[endElement] uri=,local=document,qname=document
[endDocument]


================================================================
Can anyone figure it out whats wrong ??? Thanks in advance and let me know if you need anything else.

Looking forward for your help


With Regards
Sam