2 Replies Latest reply on Jun 17, 2003 12:38 PM by Vadim Snitkovsky

    mysql -service config in Jboss 3.2.1

    Vadim Snitkovsky Newbie

      I am trying to connect to mySql using the mysql-service.xml

      I keep on getting the error below while starting JBoss. This config worked great on Jboss 3.0 and does not work with Jboss 3.2

      ----------------------------------
      error is below:
      ----------------------------------
      15:26:19,159 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss/server/default/depl
      oy/mysql-service.xml
      15:26:19,589 INFO [ServiceConfigurator] Problem configuring service jboss.jca:service=LocalTxDS,nam
      e=mysqlDS
      org.jboss.deployment.DeploymentException: No Attribute found with name: JndiName
      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:332)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
      at org.jboss.system.ServiceConfigurator.processDependency(ServiceConfigurator.java:437)
      at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:350)
      at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
      at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
      at org.jboss.system.ServiceController.install(ServiceController.java:225)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
      )

      .............................

      at org.jboss.Main$1.run(Main.java:388)
      at java.lang.Thread.run(Thread.java:479)
      + nested throwable:
      javax.management.AttributeNotFoundException: Writable attribute 'ManagedConnectionFactoryName' not f
      ound
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.setAttribute(ReflectedMBeanDispatcher.ja
      va:190)
      at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:503)
      at org.jboss.system.ServiceConfigurator.setAttribute
      (ServiceConfigurator.java:468)

      .............................

      at $Proxy6.deploy(Unknown Source)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:365)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:272)
      at org.jboss.Main.boot(Main.java:150)
      at org.jboss.Main$1.run(Main.java:388)
      at java.lang.Thread.run(Thread.java:479)
      15:26:20,891 INFO [MainDeployer] Deployed package: file:/D:/jboss/server/default/deploy/mysql
      -service.xml



      ----------------------------------
      mysql-service.xml is below:
      ----------------------------------


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

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



      <!-- ==================================================================== -->
      <!-- ConnectionManager setup for Oracle dbs -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- Thanks to Steven Coy -->
      <!-- ==================================================================== -->




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

      <application-policy name = "OracleDbRealm">

      <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 OracleDbRealm above
      OracleDbRealm
      -->

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


      mysqlDS



      <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://ipAddressGoesHere:3306/user</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">user</config-property>
      <config-property name="Password" type="java.lang.String">user</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





        • 1. Re: mysql -service config in Jboss 3.2.1
          Tim Bauer Novice

          Vadim,

          I read your post(problem) at http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= JBoss 3.2 YOU CAN'T USE the old style datasource configuration files like: mysql-service.xml

          Look in your folder: /jboss-3.2.1/docs/examples/jca/mysql-ds.xml

          This is the example file:


          <local-tx-datasource>
          <jndi-name>MySqlDS</jndi-name>
          <connection-url>jdbc:mysql://dell:3306/jbossdb</connection-url>
          <driver-class>org.gjt.mm.mysql.Driver</driver-class>
          <user-name>x</user-name>
          y
          </local-tx-datasource>



          Get rid of your mysql-service.xml file in your /deploy directory and put the new mysql-ds.xml file...You can call it ANYTHING you want, BUT IT HAS TO END IN "-ds.xml"...that's required!!

          I call mine: mysql-icsreg-ds.xml.

          It tells me that:
          1). Its a mysql datasource
          2). It belongs to my app called: icsreg

          Here's my new and improved -ds.xml file:


          <local-tx-datasource>
          <jndi-name>ICSRegDS</jndi-name>
          <connection-url>jdbc:mysql://localhost/icsboomerang?useUnicode=true&amp;characterEncoding=UTF8</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>myusername</user-name>
          mypassword
          <min-pool-size>50</min-pool-size>
          <max-pool-size>200</max-pool-size>
          <blocking-timeout-millis>10000</blocking-timeout-millis>
          <idle-timeout-minutes>15</idle-timeout-minutes>
          </local-tx-datasource>



          First you see that I add some extra attributes on the connection URL:
          These tell mysql to use ?useUnicode=true

          and
          &amp;characterEncoding=UTF8

          NOTICE THAT I USE THE &amp; NOT &

          You can see I added the min-pool,max-pool, blocking, idle attributes.
          You can also see that I use a different(new) driver class:
          <driver-class>com.mysql.jdbc.Driver</driver-class>

          because I am using the LATEST AND GREATEST mysql driver:
          mysql-connector-java-3.0.8-stable-bin.jar

          which I put in my /server/default/lib directory...

          You can download the latest mysql driver at:

          http://www.mysql.com/downloads/api-jdbc-stable.html

          Hope this helps...cheers, tim

          • 2. Re: mysql -service config in Jboss 3.2.1
            Vadim Snitkovsky Newbie

            This was exactly what I needed. Thank You Very Much.