[jboss-user] [Datasource Configuration] - Deploying datasource via -ds.xml files in JBoss AS 7.1.1.Final

Srinivas Reddy Bijjam do-not-reply at jboss.com
Thu Sep 27 13:54:51 EDT 2012


Srinivas Reddy Bijjam [https://community.jboss.org/people/srinivas.bijjam] created the discussion

"Deploying datasource via -ds.xml files in JBoss AS 7.1.1.Final"

To view the discussion, visit: https://community.jboss.org/message/762017#762017

--------------------------------------------------------------
Dear All

*  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*
*+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+*
+22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at xxx.utils.DataSourceHelper.getDataSource(DataSourceHelper.java:31)+
+22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)+
+22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)+
+22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)+
+22:53:08,531 ERROR [stderr] (http--127.0.0.1-8080-4)      at java.lang.reflect.Method.invoke(Method.java:597)+
+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)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)+
+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)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:105)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,546 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)+
+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)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+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)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:80)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+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)+
+22:53:08,562 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+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)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+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)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+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)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)+
+22:53:08,578 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)+
+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)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:179)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)+
+22:53:08,593 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)+
+22:53:08,609 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)+
+22:53:08,609 ERROR [stderr] (http--127.0.0.1-8080-4)      at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)+

*java code to look up is* 


| 
 |    | 
 | Context ctx = new InitialContext(); |
| 
 |    | 
 | return (javax.sql.DataSource) ctx.lookup("java:/"+dsName); |


*mydatasource-ds.xml*
<?xml version="1.0" encoding="UTF-8"?><datasources>
<xa-datasource enabled="true" jndi-name="java:/mydatasource" pool-name="mydatasource" use-java-context="true">
<xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:orcl</xa-datasource-property>
<driver>ojdbc6</driver>
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
<is-same-rm-override>false</is-same-rm-override>
<no-tx-separate-pools>true</no-tx-separate-pools>
</xa-pool>
<security>
<user-name>xxx</user-name>
<password>xxx</password>
</security>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</xa-datasource>
</datasources>

*standalonefull.xml content is* 

            <datasources>
                <xa-datasource jndi-name="java:/xxx-oraclePool" pool-name="xxx-oraclePool" enabled="true" use-java-context="true">
                    <xa-datasource-property name="URL">
                        jdbc:oracle:thin:@localhost:1521:orcl
                    </xa-datasource-property>
                    <driver>ojdbc6</driver>
                    <xa-pool>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>20</max-pool-size>
                        <prefill>true</prefill>
                        <is-same-rm-override>false</is-same-rm-override>
                        <no-tx-separate-pools>true</no-tx-separate-pools>
                    </xa-pool>
                    <security>
                        <user-name>xxx</user-name>
                        <password>xxx</password>
                    </security>
                </xa-datasource>
                <drivers>
                    <driver name="ojdbc6" module="com.oracle.ojdbc6">
                        <driver-class>oracle.jdbc.OracleDriver</driver-class>
                        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>

*module.xml is* 
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">
  <resources>
    <resource-root path="ojdbc6.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
</dependencies>
</module>

What is the reason it is throwing error for ds.xml but working fine for standalone-full.xml?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/762017#762017]

Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120927/0a6a4149/attachment-0001.html 


More information about the jboss-user mailing list