[jboss-jira] [JBoss JIRA] (JBJCA-944) Not possible to get access to the underlying DataSource through WrapperDataSource

RH Bugzilla Integration (JIRA) jira-events at lists.jboss.org
Wed Dec 12 11:18:18 EST 2012


    [ https://issues.jboss.org/browse/JBJCA-944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740957#comment-12740957 ] 

RH Bugzilla Integration commented on JBJCA-944:
-----------------------------------------------

Shay Matasaro <smatasar at redhat.com> made a comment on [bug 886594|https://bugzilla.redhat.com/show_bug.cgi?id=886594]

see https://issues.jboss.org/browse/JBJCA-944


case https://c.na7.visual.force.com/apex/Case_View?sbstr=00751078
                
> Not possible to get access to the underlying DataSource through WrapperDataSource
> ---------------------------------------------------------------------------------
>
>                 Key: JBJCA-944
>                 URL: https://issues.jboss.org/browse/JBJCA-944
>             Project: IronJacamar
>          Issue Type: Bug
>    Affects Versions: 1.0.11.Final
>            Reporter: Siamak Sadeghianfar
>            Assignee: Jesper Pedersen
>            Priority: Critical
>
> 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: 
> {code:java} 
>     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();
>                         }
>                 }
> {code}
> {noformat}
> 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)
> {noformat}
> [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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list