[jboss-jira] [JBoss JIRA] (JBJCA-944) Not possible to get access to the underlying DataSource through WrapperDataSource
Shay Matasaro (JIRA)
jira-events at lists.jboss.org
Wed Dec 12 15:09:17 EST 2012
[ https://issues.jboss.org/browse/JBJCA-944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741012#comment-12741012 ]
Shay Matasaro commented on JBJCA-944:
-------------------------------------
Hi Siamak,
Jesper's suggestion is that start a thread in the forum regarding this item.
Shay
> 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