Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-105

[dbcp] JNDI problems with SharedPoolDataSource

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • Operating System: other
      Platform: Other

    • 38073

    Description

      It is currently not possible to bind a SharedPoolDataSource into jndi and
      retrieve it again via a lookup. The problem was seen in tomcat's naming
      implementation, but is likely to be not limited to that implementation.
      The problem is: SharedPoolDataSource implements javax.naming.Referenceable via
      its parent InstanceKeyDataSource. Referenceable specifies that a getReference()
      method is implemented, which returns a javax.naming.Reference object. The
      reference object contains a reference to a factory for the object. In the
      implementation of InstanceKeyDataSource, dbcp's InstanceKeyObjectFactory is
      specified as facory. However, this is invalid as InstanceKeyObjectFactory is
      abstract and cannot be instantiated, so upon a lookup, the object cannot be
      retrieved from jndi.

      There are two obvious solutions. First, getReference() could return the correct
      factory (SharedPoolDataSourceFactory). Second, InstanceKeyDataSource could not
      implement Referenceable any more.

      The problem also occurs for dbcp's PerUserPoolDatasource. A successfull bind can
      be done using dbcp's BasicDataSource.

      I will attach a test case which shows the wrong behaviour. It depends on the
      jars naming-common-5.0.28.jar and naming-java.5.0.28.jar which can be downloaded
      from www.ibiblio.org/maven/tomcat/jars.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--SharedPoolDataSourceJndiTest.java
          3 kB
          Thomas Fischer
        2. ASF.LICENSE.NOT.GRANTED--Dbcp-getReference-fixes.patch
          4 kB
          Sandy McArthur (from Bugzilla import)

        Activity

          People

            Unassigned Unassigned
            fischer@seitenbau.de Thomas Fischer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: