Uploaded image for project: 'IronJacamar'
  1. IronJacamar
  2. JBJCA-1065

CLONE - Not possible to get access to the underlying DataSource through WrapperDataSource

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Won't Do
    • 1.0.11.Final
    • None
    • None
    • None

    Description

      JNDI lookup for a datasource on EAP 6.0 returns an instance of WrapperDataSource [1] and since it doesn't override JBossWrapper.getWrappedObject() [2] which is in the super class, unwrap() always returns null.

      WrapperDataSource should override getWrappedObject() as stated in the javadoc to return the underlying datasource.

      With the current implementation, the following code always throws exception:

       
          Context ctx = new InitialContext();
                      DataSource ds = (DataSource)ctx.lookup("jboss/datasources/ExampleDS");
                      OracleDataSource unwrapped = null;
                     
                      if (ds instanceof WrapperDataSource) {
                              WrapperDataSource wrapper = (WrapperDataSource) ds;
                              try {
                                      unwrapped = wrapper.unwrap(OracleDataSource.class);
                              } catch (SQLException e) {
                                      e.printStackTrace();
                              }
                      }
      
      13:30:38,354 ERROR [stderr] (MSC service thread 1-2) java.sql.SQLException: Not a wrapper for: oracle.jdbc.pool.OracleDataSource
      13:30:38,354 ERROR [stderr] (MSC service thread 1-2) at org.jboss.jca.adapters.jdbc.JBossWrapper.unwrap(JBossWrapper.java:82)
      

      [1] http://source.jboss.org/browse/IronJacamar/tags/IRONJACAMAR_1_0_11_FINAL/adapters/src/main/java/org/jboss/jca/adapters/jdbc/WrapperDataSource.java?hb=true
      [2] http://source.jboss.org/browse/IronJacamar/tags/IRONJACAMAR_1_0_11_FINAL/adapters/src/main/java/org/jboss/jca/adapters/jdbc/JBossWrapper.java?r=111565#to90

      Attachments

        Issue Links

          Activity

            People

              jpederse@redhat.com Jesper Pedersen
              mwiede@gmx.de Matthias Wiedemann (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: