Unintuitive workings of the MySQL DBPool deployment wizard
----------------------------------------------------------

                 Key: GERONIMO-3596
                 URL: https://issues.apache.org/jira/browse/GERONIMO-3596
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: connector, databases, deployment
    Affects Versions: 2.0.2
         Environment: ogre% uname -a
FreeBSD ogre 7.0-BETA2 FreeBSD 7.0-BETA2 #4: Sat Nov 10 15:29:36 CET 2007     
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/OGRE  amd64
ogre% java -version
java version "1.6.0_02-p2"
Java(TM) SE Runtime Environment (build 1.6.0_02-p2-root_04_nov_2007_14_03-b00)
Java HotSpot(TM) 64-Bit Server VM (build 
1.6.0_02-p2-root_04_nov_2007_14_03-b00, mixed mode)

Nothing else. I don't think it matters at all for this bug report anyway.
            Reporter: Jesper Louis Andersen


There is an unintuitive gotcha hidden in the DBPool wizard for the MySQL (and 
probably also the MySQL-XA) driver. It manifests itself
with a NullPointerException when trying to connect to a database. See for 
instance the following mail:

http://spteam-lists.blogspot.com/2007/11/re-apache-geronimo-202-and-mysql-data.html

The reason is that if you DON'T fill out the URL field, you get the following 
deployment plan:

++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2";>
    <dep:environment 
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";>
        <dep:moduleId>
            <dep:groupId>console.dbpool</dep:groupId>
            <dep:artifactId>cxnet</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>rar</dep:type>
        </dep:moduleId>
        <dep:dependencies>
            <dep:dependency>
                <dep:groupId>mysql</dep:groupId>
                <dep:artifactId>mysql-connector-java</dep:artifactId>
                <dep:version>5.1.5</dep:version>
                <dep:type>jar</dep:type>
            </dep:dependency>
        </dep:dependencies>
    </dep:environment>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>cxnet</name>
                    <config-property-setting 
name="DatabaseName">foo</config-property-setting>
                    <config-property-setting 
name="Password">foo</config-property-setting>
                    <config-property-setting 
name="UserName">foo</config-property-setting>
                    <config-property-setting name="URL"/>
                    <connectionmanager>
                        <no-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>
+++++++++++++++++++++++++++++++++++++

Notice the Empty URL parameter. Quick workaround: Supply the URL parameter or 
use the 'show plan' feature and add the URL in
the plan.

Steps to reproduce:

1. Add a mysql-connector-java JAR to the library section. I used 5.1.5 as a 
version, but it also fails with 5.0.8 and 3.1.14.
2. Click Database Pools -> Wizard -> choose 'foo' and MySQL as driver
3. Enter the fields: pool name, database driver, port number, user name, server 
name, database name, password and confirm password 
take care NOT to enter the URL. 
4. Now click 'show plan'. It this point it should be obvious that we are trying 
to deploy a plan without an URL.

The idea for a fix:

1. Gather fields from input.
2. If URL is empty, stitch together one from the other parameters.
3. Use the constructed URL.

And do take care to report this back to the guy in the linked mail above ;)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to