0 Replies Latest reply on May 14, 2003 3:22 AM by sabar

    connect to mysql through jboss by servlet

    sabar Newbie

      Hi

      i am a newer with jboss, mysql and use eclipse , i did the following steps to make jboss to connect mysql to run my servlet :

      1.create mysql data base [db.name]

      2.copy mm.mysql-2.0.14-bin.jar to [jboss.dir]/server/default/lib

      3. server/default/conf/standardjbosscmp-jdbc.xml, replace the Hyper SQL with these 2:
      java:/MySqlDS
      <datasource-mapping>mySQL</datasource-mapping>

      4. server/default/conf/standardjaws.xml, replace the Hyper SQL with these 2:
      java:/MySqlDS
      <type-mapping>mySQL</type-mapping>

      5. copy docs/examples/jca/mysql-service.xml into /server/default/deploy

      6. update mysql-service.xml with your MySql login/password, and use the following:

      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->



      <!-- ==================================================================== -->
      <!-- New ConnectionManager setup for mysql using 2.0.11 driver -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- ==================================================================== -->




      <!-- Include a login module configuration named MySqlDbRealm.
      Update your login-conf.xml, here is an example for a
      ConfiguredIdentityLoginModule:

      <application-policy name = "MySqlDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal">yourprincipal</module-option>
      <module-option name = "userName">yourusername</module-option>
      <module-option name = "password">yourpassword</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
      </login-module>

      </application-policy>

      NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
      module-option name = "managedConnectionFactoryName"
      must match the object name of the ConnectionManager you are configuring here.
      -->
      <!--uncomment out this line if you are using the MySqlDbRealm above
      MySqlDbRealm
      -->

      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      MySqlDS



      <config-property name="url" type="java.lang.String">jdbc:mysql://localhost:3306/partdb</config-property>
      <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
      <!--set these only if you want only default logins, not through JAAS -->
      <config-property name="userName" type="java.lang.String">test</config-property>
      <config-property name="password" type="java.lang.String">test</config-property>




      <!--Below here are advanced properties -->
      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper




      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->


      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer



      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager

      java:/TransactionManager
      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer








      7. when restart jboss i got the following errors

      09:16:47,800 ERROR [URLDeploymentScanner] MBeanException: Exception in MBean ope
      ration 'checkIncompleteDeployments()'
      Cause: Incomplete Deployment listing:
      Packages waiting for a deployer:

      Incompletely deployed packages:

      MBeans waiting for classes:

      MBeans waiting for other MBeans:
      [ObjectName: jboss.jca:service=LocalTxCM,name=MySqlDS
      state: FAILED
      I Depend On: jboss.jca:service=LocalTxDS,name=MySqlDS
      jboss.jca:service=LocalTxPool,name=MySqlDS
      jboss.jca:service=CachedConnectionManager
      jboss.security:service=JaasSecurityManager
      jboss.jca:service=RARDeployer

      Depends On Me: java.lang.IllegalArgumentException: The class 'class org.jboss.r
      esource.adapter.jdbc.local.LocalManagedConnectionFactory' has no setter for conf
      ig property 'url']
      09:16:47,810 INFO [URLDeploymentScanner] Started
      09:16:47,810 INFO [MainDeployer] Deployed package: file:/E:/jboss-3.0.4/server/
      default/conf/jboss-service.xml
      09:16:47,830 INFO [Server] JBoss (MX MicroKernel) [3.0.4 Date:200211021607] Sta
      rted in 1m:0s:146ms


      pls tell me what is the problem and how to connect correctly to mysql through jboss to run my servlet

      with regards