2 Replies Latest reply on Apr 25, 2002 2:20 PM by kstoll

    Jboss + MySql

      Hi.
      I've just installed MySql and JBoss. They both work seperately could anyone please tell me exactly how to configure jboss to use mysql. I need a step by step example please... (ive seen the documentation and i couldnt make it please help...)

      Thanks

      Tomer

        • 1. Re: Jboss + MySql
          jtwomey

          Assuming you are not running jBoss 3, as I have not been there yet. This should work.


          1. Go here http://mmmysql.sourceforge.net/ and download the mySQL JDBC driver.

          2. Place the driver jar in the /lib/ext directory which you will find in the jboss directoy.

          3. Copy the code below and place it in the jboss.jcml file which you will find in the /conf directory. If you are running an integrated distribution (jBoss + Tomcat for ex.) make sure you change the jBoss.jcml in the /conf/catalina directory.


          <!-- ==================================================================== -->
          <!-- JDBC -->
          <!-- ==================================================================== -->


          org.gjt.mm.mysql.Driver



          DefaultDS
          org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl

          jdbc:mysql://localhost:3306/MyDatabaseName
          1200000
          MyDataBaseUsername
          MyDataBasePassword
          10
          false
          false
          false
          true
          120000
          1800000
          false
          false
          1.0
          0


          4. You will have to change the following attributes in the above code to match your specific setup:
          jdbc:mysql://localhost:3306/MyDatabaseName
          MyDataBaseUsername
          MyDataBasePassword

          For example if mySQL is on a different box your URL may be:
          jdbc:mysql://www.MyDomain:3306/MyDatabaseName
          or
          if mySQl is listening on another port you will change the 3306 to that port.


          5. COMMENT OUT or remove the existing Hypersonic pool.(the code below)

          <!--

          org.hsqldb.jdbcDriver



          1476
          true
          default
          false



          DefaultDS
          org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl

          jdbc:hsqldb:hsql://localhost:1476
          1200000
          sa
          10

          false
          false
          false
          true
          120000
          1800000
          false
          false
          1.0
          0

          -->

          5. In the standardjaws.xml file, which is in the same directory as the jboss.jcml file, change the beginning of the listing at the very top of the file to this.


          java:/DefaultDS
          <type-mapping>mySQL</type-mapping>
          false .....................
          .........................
          ......................

          6. Restart jBoss.

          7. To test, run the CD demo in the examples. (we know it works!)

          Hope this helps for all to come.

          • 2. Re: Jboss + MySql
            kstoll

            I followed your example closely with JBoss 2.4.4 and Catalina. I added the xml snippet to both the default and catalina jboss.jcml files and copied the driver jar to the JBOSS_HOME/lib/ext directory.

            The error I am getting is a ClassNotFoundError, as follows:

            [13:33:34,310,JdbcProvider] Could not load driver:org.gjt.mm.mysql.Driver
            java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
            at javax.management.loading.MLet.findClass(MLet.java:800)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:120)
            at org.jboss.jdbc.JdbcProvider.initService(JdbcProvider.java:71)
            at org.jboss.util.ServiceMBeanSupport.init(ServiceMBeanSupport.java:77)
            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.init(Unknown Source)
            at org.jboss.util.ServiceControl.init(ServiceControl.java:54)
            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:207)
            at org.jboss.Main$1.run(Main.java:110)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.jboss.Main.main(Main.java:106)