• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help on jboss datasource configuration

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Configuring datasource in jboss4.2.2GA

mssql-xa-da.xml file
----------------------

<datasources>
<xa-datasource>
<jndi-name>mssqlxads</jndi-name>
<track-connection-by-tx/>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:mysql://localhost:3306/test</xa-datasource-property>

<!-- not sure if these should be here-->
<user-name>tester</user-name>
<password>tester</password>

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
<metadata>
<type-mapping>MS SQLSERVER2000</type-mapping>
</metadata>
</xa-datasource>

</datasources>


JAVA FILE
---------

InitialContext ic = new InitialContext();
if(ic!=null){
DataSource ds = (DataSource)ic.lookup("java:/mssqlxads");
con = ds.getConnection();//Exception from this line (ClassCastException com.mysql.jdbc.jdbc2.optional.MysqlDataSource)

Can anyone help me.

Thanks.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post the entire exception stacktrace. And by any chance are you packaging the driver jar file inside your application? If yes, remove it from your application and place it in %JBOSS_HOME%/server/< serverName>/lib folder.
 
Maya Pillai
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...

Please find the error console



18:17:59,785 WARN [JBossManagedConnectionPool] Throwable while attempting to ge
t a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested
throwable: (java.lang.ClassCastException: com.mysql.jdbc.jdbc2.optional.MysqlDa
taSource)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createM
anagedConnection(XAManagedConnectionFactory.java:144)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.cr
eateConnectionEventListener(InternalManagedConnectionPool.java:577)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.ge
tConnection(InternalManagedConnectionPool.java:262)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BaseP
ool.getConnection(JBossManagedConnectionPool.java:538)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManage
dConnection(BaseConnectionManager2.java:341)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedCo
nnection(TxConnectionManager.java:315)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateC
onnection(BaseConnectionManager2.java:396)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$Connectio
nManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(Wrapp
erDataSource.java:88)
at net.assyst.aims.dao.BdmInboxDAO.getBdmInboxDetails(BdmInboxDAO.java:5
8)
at net.assyst.aims.bo.BdmInboxBO.getBdmInboxDetails(BdmInboxBO.java:34)
at net.assyst.aims.session.BdmInboxAction.listBdmInbox(BdmInboxAction.ja
va:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationCo
ntextImpl.java:166)
at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationCo
ntext.java:37)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
Context.java:57)
at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(Bijecti
onInterceptor.java:47)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocation
Context.java:69)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(Met
 
I think she's lovely. It's this tiny ad that called her crazy:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic