There ware a thread called "Interesting ClassCastException" while configuring DataSource for MSSQL DB.
I have the same problem :(
I modified mssql-ds.xml file from doc/examples... directory, put it into sever/default/deploy directory and run the server. The datasource appeard in jmx-console. When I deploy simple application reffering to that datasource I get:
10:36:19,786 ERROR [MainDeployer] could not start deployment: file:/C:/dev/jboss323/server/default/deploy/sample.war/
org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (java.lang.ClassCastException)
at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
What am I doing wrong. My web.xml has:
My jboss-web.xml has:
And I still get ClassCastException. I don't have any third party jars in my application lib. In server/default/lib I have three jars (MSSQL JDBC drivers)
The previous thread:
I am getting a rather interesting ClassCastException fior DataSource tied to a SQl Server connection. I am using the Opti driver, and setting up the connection using the *-ds.xml style settup file. Also, am running ver 3.2.1 of Jboss with Tomcat, compiled and ran on the 1.4. jdk/VM. Here is the issue; when the DataSource is obtained from jndi, and cast to a DataSource, there is a Class cast expepiton when the WrapperDataSource is cast. I have inserted quite a bit of debug material-- and here's the wierd part; The object returned is a WrapperDatasource object (not null) where debug lines say it implements the DataSource interface, but is NOT an instanceof DataSource. For a sanity check, I made sure we are talking about the DataSource in the right namespace. How is it possible that the object is a WrapeprDatasource that sure enough implemnts DataSource interface (as it should..along with Serializable, Referenceable, etc..), but is not an instance of DataSource? Experiments where I compile/run against 1.3 jdk/vm yield identical results.
Just wanted to post the fix for this issue. Or at least, the fix that worked for me. I removed just about all of the third party jar libs from the ear file. Iterestingly enough, none of them contained the DataSource class--- but it fixed the issue. I moved those files to the server/lib directory