3 Replies Latest reply on Feb 8, 2002 11:02 PM by David Jencks

    [JBoss 2.4.4] Castor and MSSQL - error loading CastorJDOImpl

    Michael Schulz Newbie

      I [finally] found the castorjdoplugin.jar that was recently rebuilt for JBoss 2.4.4 and Castor 0.9.3.9. I've got the MBean configured and I'm attempting to use an MSSQL database. Note: I have already been successful at defining a standard JBoss connection pool to this datasource. When I define the Castor MBean, I use the same class name as I use for the connection pool, but I get an error when JBoss attempts to load the MBean. I've attached the stack trace from the JBoss log file, the MBean for the standard database connection to this database, and the MBean for the CastorJDO connection to this database. Anyone have any ideas why this error is being thrown? It looks to me like the CastorJDOImpl code is complaining about the SQL Server class not extending the DataSource class. Could this be true? Is this a bad assumption made by the CastorJDOImpl code? Thanks for any insight you can provide.

      Inline attachments:

      FROM JBOSS.CONF:

      com.microsoft.jdbc.sqlserver.SQLServerDriver


      FROM JBOSS.CONF:

      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
      CalumetOnlineDevPool
      jdbc:microsoft:sqlserver://localhost:1863
      DatabaseName=CalumetOnlineDev


      FROM JBOSS.CONF:

      file:../conf/default/castordb.xml
      jdo/Test
      0
      true
      true
      false
      true


      FROM CASTORDB.XML:
      <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN" "http://castor.exolab.org/jdo-conf.dtd">


      <data-source class-name="com.microsoft.jdbc.sqlserver.SQLServerDriver">
      <params port-number="1863" server-name="localhost" />
      </data-source>





      FROM JBOSS ERROR LOG:

      [INFO,CastorJDOImpl] Starting
      [ERROR,CastorJDOImpl] Stopped
      java.lang.IllegalStateException: Data source class name does not extend javax.sql.DataSource
      at org.exolab.castor.jdo.conf.DataSource.createParams(DataSource.java:131)
      at org.exolab.castor.jdo.conf.DataSourceDescriptor$2.newInstance(DataSourceDescriptor.java:130)
      at org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1023)
      at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1340)
      at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1214)
      at org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1806)
      at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1182)
      at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
      at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
      at org.jboss.jdo.castor.CastorJDOImpl.startService(CastorJDOImpl.java:115)
      at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:967)
      at $Proxy0.start(Unknown Source)
      at org.jboss.util.ServiceControl.start(ServiceControl.java:79)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      at org.jboss.Main.(Main.java:208)
      at org.jboss.Main$1.run(Main.java:110)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.Main.main(Main.java:106)
      [ERROR,ConfigurationService] Unexpected error

        • 1. Re: [JBoss 2.4.4] Castor and MSSQL - error loading CastorJDO
          David Jencks Master

          Driver != DataSource
          com.microsoft.jdbc.sqlserver.SQLServerDriver is not a DataSource implementation.

          I doubt very much that you can use a jboss pool inside castor, at least not with that syntax: it appears to be specifying how to create an configure a DataSource rather than how to look one up in jndi and use it. Have you consulted the Castor docs or the jboss-castor howto?

          • 2. Re: [JBoss 2.4.4] Castor and MSSQL - error loading CastorJDO
            Michael Schulz Newbie

            Yes, I have looked at all the docs. After I realized my DataSource != Driver mistake last night, I changed the MBean from using com.microsoft.jdbcx.sqlserver.SQLServerDriver to com.microsoft.jdbcx.sqlserver.SQLServerDataSource.

            Now the error that appears in the JBoss log at startup is this:

            [07:43:16,767,CastorJDOImpl] Starting
            [07:43:17,909,ConfigurationService] Unexpected error
            java.lang.NoClassDefFoundError: javax/sql/DataSource
            at java.lang.ClassLoader.defineClass0(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$100(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at java.lang.ClassLoader.defineClass0(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$100(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at org.exolab.castor.jdo.conf.DataSource.createParams(DataSource.java:124)
            at org.exolab.castor.jdo.conf.DataSourceDescriptor$2.newInstance(DataSourceDescriptor.java:130)


            As far as I can tell, the jboss-jdbc_ext.jar contains the javax.sql.DataSource class which the CastorMBeanImpl is attempting to load, so I don't understand why it cannot find it.

            • 3. Re: [JBoss 2.4.4] Castor and MSSQL - error loading CastorJDO
              David Jencks Master

              people never learn. Castor is making bad assumptions about who can find classes for it, using class.forName().

              Is the castor.jar in lib/ext or in the JBOSS_CLASSPATH? if the latter, you might have better luck with the former.

              Despite my previous pessimism, I'd also look around in the castor docs and see if there is some way to use an external datasource that castor can look up in jndi, and use a pool instead of a plain datasource.