Class Cast Exception when connecting to DataSource--JBoss4.0
russray Nov 18, 2006 12:35 PMGosh, I hope someone will answer this. I have tried for the last two days to get someone to assist me. I've research all over the net for answers and had no success on uncovering an answer.
The issue is I have a J2EE project deploying to a JBoss server. I've got the server configured as per the install program for JBoss. Howerver, starting the server produces the below error:
11:11:52,476 INFO [WrapperDataSourceService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/pidbdev' to JNDI name 'java:jdbc/pidbdev' 11:11:52,538 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.lang.ClassCastException: com.microsoft.jdbc.sqlserver.SQLServerDriver) .... Caused by: java.lang.ClassCastException: com.microsoft.jdbc.sqlserver.SQLServerDriver at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:239) at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:156)
I have setup the data correctly as far as I can tell:
-ds.xml
<datasources> <xa-datasource> <jndi-name>jdbc/pidbdev</jndi-name> <xa-datasource-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</xa-datasource-class> <xa-datasource-property name="URL">jdbc:microsoft:sqlserver://me_server:1433;databaseName=me_db</xa-datasource-property> <xa-datasource-property name="User">p1</xa-datasource-property> <xa-datasource-property name="Password">p1</xa-datasource-property> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <metadata> <type-mapping>MS SQLSERVER2000</type-mapping> </metadata> <check-valid-connection-sql>SELECT * FROM invalidate</check-valid-connection-sql> </xa-datasource> </datasources>
jboss-web.xml
<jboss-web> <resource-ref> <res-ref-name>jdbc/pidbdev</res-ref-name> <jndi-name>java:/pidbdev</jndi-name> </resource-ref> </jboss-web>
web.xml
<resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/pidbdev</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
When I go looking at the datasource within the jmx-console, I see this
Name Type Value JndiName java.lang.String jdbc/pidbdev UseJavaContext boolean True JMXInvokerName javax.management.ObjectName jbosss:service=invoker,type=jrmp StateString java.lang.String Started State int 3 ConnectionManager javax.management.ObjectName jboss.jca:service=XATxCM,name=jdbc/pidbdev BindName java.lang.String java:jdbc/pidbdev Name java.lang.String WrapperDataSourceService
Can someone help me, please?
Thanks for taking the time to read my post.
Russ