[jboss-jira] [JBoss JIRA] (JBJCA-1065) CLONE - Not possible to get access to the underlying DataSource through WrapperDataSource
Matthias W (JIRA)
jira-events at lists.jboss.org
Mon Jul 29 10:43:26 EDT 2013
Matthias W created JBJCA-1065:
---------------------------------
Summary: CLONE - Not possible to get access to the underlying DataSource through WrapperDataSource
Key: JBJCA-1065
URL: https://issues.jboss.org/browse/JBJCA-1065
Project: IronJacamar
Issue Type: Bug
Affects Versions: 1.0.11.Final
Reporter: Matthias W
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