Commons Dbcp
  1. Commons Dbcp
  2. DBCP-105

[dbcp] JNDI problems with SharedPoolDataSource

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      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.

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Thomas Fischer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development