Details
-
Bug
-
Resolution: Won't Do
-
Critical
-
None
-
1.0.11.Final
-
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
- clones
-
JBJCA-944 Not possible to get access to the underlying DataSource through WrapperDataSource
- Closed