1 Reply Latest reply on Feb 25, 2004 4:45 AM by maciej.bajolek

    MSSQL 2000 + JBOSS 3.x problem

    maciej.bajolek Newbie

      Hi All,
      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 org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:440)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:832)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:642)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:605)
      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)

      Pls: HELP

      The previous thread:

      Hello all;
      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

        • 1. Re: MSSQL 2000 + JBOSS 3.x problem
          maciej.bajolek Newbie


          Finally I remove all other MSSQL Datasource definitions form my JBoss deploy directory.
          When I have only one MSSQL Datasource the applications deploys withoud ClassCastException, but when I have two MSSQL datasource references in my application I get ClassCastException.

          How to setup more then one MSSQL Datasource for JBoss 3.0.x/3.2.x?
          I tried with one *-ds.xml and two separated *-ds.xml files but it does not work.

          Best regards