3 Replies Latest reply on May 7, 2003 10:06 PM by hongjun

    JBoss3.2.0 & mySQl solution

    hasanali00

      Hi,
      Recently I was trying to make JBoss 3.2.0 to connect to MySql, but was having a lot of problems. So here is how I did it (see below). The solution is really straight forward, but took a lot of time since there were no official documentations describing the solution.

      However, even though my db connection works properly, when I start Jboss I still get some errors such as:

      16:27:52,691 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean operation 'checkIncompleteDeployments()'
      Cause: Incomplete Deployment listing:
      Packages waiting for a deployer:

      Incompletely deployed packages:

      MBeans waiting for classes:

      MBeans waiting for other MBeans:
      [ObjectName: jboss.mq:service=InvocationLayer,type=HTTP
      state: CONFIGURED
      I Depend On: jboss.mq:service=Invoker
      jboss.web:service=WebServer

      Depends On Me: , ObjectName: jboss.mq.destination:service=Topic,name=testTopic
      state: CONFIGURED
      I Depend On: jboss.mq:service=DestinationManager
      jboss.mq:service=SecurityManager

      Depends On Me: , ObjectName: jboss.mq.destination:service=Topic,name=securedTop
      ic
      .....
      ......
      state: CONFIGURED
      I Depend On: jboss.mq:service=DestinationManager
      jboss.mq:service=SecurityManager

      Depends On Me: , ObjectName: jboss.mq:service=Invoker
      state: CONFIGURED
      I Depend On: jboss.mq:service=TracingInterceptor


      state: CONFIGURED
      I Depend On: jboss.mq:service=MessageCache
      jboss.jca:service=LocalTxCM,name=DefaultDS

      Depends On Me: jboss.mq:service=DestinationManager
      , ObjectName: jboss.mq.destination:service=Queue,name=DLQ
      state: CONFIGURED
      I Depend On: jboss.mq:service=DestinationManager
      jboss.mq:service=SecurityManager

      Depends On Me: ]
      16:27:52,711 INFO [URLDeploymentScanner] Started
      16:27:52,761 INFO [MainDeployer] Deployed package: file:/C:/Java/JBoss/jboss-3.
      2.0_tomcat-4.1.24/server/default/conf/jboss-service.xml
      16:27:52,761 INFO [Server] JBoss (MX MicroKernel) [3.2.0 (build: CVSTag=JBoss_3
      _2_0 date=200304110033)] Started in 27s:19ms


      Anyway, the next challenge is to make JBoss talk to multiple mySql databases.

      Does anyone have any thoughts on it?

      The file attachment was not working, so i have pasted my solution below:

      ============= solution================

      To make Jboss 3.2.0 talk to mysql, do the following:

      1. get mysql driver and put in into JBoss/server/ ‘default ‘or ‘all’ /lib
      2. get rid of the hsqldb-ds.xml from JBoss deploy directory.
      3. get mysql-ds.xml from jboss/docs/examples.jca and copy it into deploy directory
      4. edit this file. I have the following:

      <local-tx-datasource>
      <jndi-name>MySqlDS</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/DatabaseName</connection-url>
      <driver-class>org.gjt.mm.mysql.Driver</driver-class>
      <user-name>your username for database </user-name>
      your password for database
      </local-tx-datasource>

      5. edit standardjbosscmp-jdbc.xml and standardjaws.xml (under JBoss/server/ all or default/conf. I have as following.
      In standardjbosscmp-jdbc.xml, I have:
      <jbosscmp-jdbc>


      java:/MySqlDS
      <datasource-mapping>mySQL</datasource-mapping>

      <create-table>true</create-table>
      ……..

      In standardjaws.xml, I have:

      java:/MySqlDS
      <type-mapping>mySQL</type-mapping>
      false
      …….

      6. then I uses the following tags in jboss.xml file (this is the file which is bundled with your application, in META-INF directory.
      <resource-managers>
      <resource-manager>
      <res-name>MySqlDS</res-name>
      <res-jndi-name>java:/MySqlDS</res-jndi-name>
      </resource-manager>
      </resource-managers>


      hopefully this should work.

        • 1. Re: JBoss3.2.0 & mySQl solution
          sunhao100

          Budy, good job, I follow your procedure and make my EJB work, by the way, it seems you don't need to copy JDBC driver.

          • 2. Re: JBoss3.2.0 & mySQl solution
            davidjencks

            The incomplete deployment exception you are getting is because the jbossmq persistence manager was configured to use DefaultDS which was set up in hsqldb-ds.xml which you removed. You can:

            remove the mq components
            change the "jdbc2" mq persistence manager to use your mysql datasource
            change jbossmq to use a non-jdbc persistence manager
            rename your datasource to DefaultDS, or add another one bound as DefaultDS
            or
            reinstall hsqldb-ds.xml just for jbossmq

            • 3. Re: JBoss3.2.0 & mySQl solution
              hongjun

              I have the same exceptions. Could you please explain the solution little more? Can't quite understand.