<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Deploying datasource via -ds.xml files in JBoss AS 7.1.1.Final
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/srinivas.bijjam">Srinivas Reddy Bijjam</a> in <i>Datasource Configuration</i> - <a href="https://community.jboss.org/message/762017#762017">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Dear All</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>  I am getting the following error while looking up the datasource that was bounded by ds.xml file but it is working fine with the datasource that is defined in standalonefull.xml</strong></p><p style="padding-left: 60px;"><strong style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4) java.lang.ClassCastException: javax.naming.Reference cannot be cast to javax.sql.DataSource</em></strong></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at xxx.utils.DataSourceHelper.getDataSource(DataSourceHelper.java:31)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at java.lang.reflect.Method.invoke(Method.java:597)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:105)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:80)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$1.processInvocation(EjbExceptionTransformingInterceptorFactories.java:65)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:179)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,609 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)</em></span></p><p style="padding-left: 60px;"><span style="font-size: 10pt;"><em>22:53:08,609 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)</em></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>java code to look up is </strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><table><tbody><tr><td style=";"><br/></td><td style=";">  </td><td style=";"><br/></td><td style=";">Context ctx = new InitialContext();</td></tr><tr><td style=";"><br/></td><td style=";">  </td><td style=";"><br/></td><td style=";">return (javax.sql.DataSource) ctx.lookup("java:/"+dsName);</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>mydatasource-ds.xml</strong></p><p><?xml version="1.0" encoding="UTF-8"?><datasources></p><p><xa-datasource enabled="true" jndi-name="java:/mydatasource" pool-name="mydatasource" use-java-context="true"></p><p><xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:orcl</xa-datasource-property></p><p><driver>ojdbc6</driver></p><p><xa-pool></p><p><min-pool-size>1</min-pool-size></p><p><max-pool-size>20</max-pool-size></p><p><prefill>true</prefill></p><p><is-same-rm-override>false</is-same-rm-override></p><p><no-tx-separate-pools>true</no-tx-separate-pools></p><p></xa-pool></p><p><security></p><p><user-name>xxx</user-name></p><p><password>xxx</password></p><p></security></p><p><xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class></p><p></xa-datasource></p><p></datasources></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>standalonefull.xml content is </strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>            <datasources></p><p>                <xa-datasource jndi-name="java:/xxx-oraclePool" pool-name="xxx-oraclePool" enabled="true" use-java-context="true"></p><p>                    <xa-datasource-property name="URL"></p><p>                        jdbc:oracle:thin:@localhost:1521:orcl</p><p>                    </xa-datasource-property></p><p>                    <driver>ojdbc6</driver></p><p>                    <xa-pool></p><p>                        <min-pool-size>1</min-pool-size></p><p>                        <max-pool-size>20</max-pool-size></p><p>                        <prefill>true</prefill></p><p>                        <is-same-rm-override>false</is-same-rm-override></p><p>                        <no-tx-separate-pools>true</no-tx-separate-pools></p><p>                    </xa-pool></p><p>                    <security></p><p>                        <user-name>xxx</user-name></p><p>                        <password>xxx</password></p><p>                    </security></p><p>                </xa-datasource></p><p>                <drivers></p><p>                    <driver name="ojdbc6" module="com.oracle.ojdbc6"></p><p>                        <driver-class>oracle.jdbc.OracleDriver</driver-class></p><p>                        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class></p><p>                    </driver></p><p>                </drivers></p><p>            </datasources></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>module.xml is </strong></p><p><?xml version="1.0" encoding="UTF-8"?></p><p><module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6"></p><p>  <resources></p><p>    <resource-root path="ojdbc6.jar"/></p><p>  </resources></p><p>  <dependencies></p><p>    <module name="javax.api"/></p><p>    <module name="javax.transaction.api"/></p><p></dependencies></p><p></module></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>What is the reason it is throwing error for ds.xml but working fine for standalone-full.xml?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/762017#762017">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Datasource Configuration at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>