5 Replies Latest reply on Sep 3, 2005 11:04 AM by mlibra

    Fedora,JBoss 3.2.7, MySQL 4.1.2 Access denied

    mlibra

      Hi All,

      I can't set up this environment.

      All I did is:
      1) I unpacked the installation package of JBoss (just downloaded from jboss.com)
      2) Copied mysql-connector-java-3.1.10-bin.jar into default/lib directory
      3) As written in many tutorials, I edited files in conf direcotry as follows:
      login-config.xml:
      Added

       <application-policy name = "MySqlDbRealm">
       <authentication>
       <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
       <module-option name ="principal">root</module-option>
       <module-option name ="userName">root</module-option>
       <module-option name ="password">mySecret</module-option>
       <module-option name ="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MySqlDS</module-option>
       </login-module>
       </authentication>
       </application-policy>
      


      standardjaws.xml
      Changed
      <type-mapping>mySQL</type-mapping>
      for java:/DefaultDS datasource

      standardjbosscmp-jdbc.xml
      Changed
      <datasource-mapping>mySQL</datasource-mapping>
      for java:/DefaultDS datasource

      Under deploy directory
      Added file mysql-ds.xml with following content:
      <datasources>
       <local-tx-datasource>
       <jndi-name>DefaultDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>root</user-name>
       <password>mySecret</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
       </local-tx-datasource>
      </datasources>
      


      Under deploy/jms I added the mysql-jdbc2-service.xml file

      I deleted files hsqldb-jdbc2-service.xml and hsqldb-ds.xml

      During the booting of JBoss I get many exceptions, the main of them is:
      MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
      ObjectName: jboss.mq:service=StateManager
       state: FAILED
       I Depend On: jboss.jca:service=LocalTxCM,name=DefaultDS
      
       Depends On Me: jboss.mq:service=DestinationManager
      javax.management.MBeanException: org.jboss.mq.SpyJMSException: Error creating connection to the database.; - nested throwable: (org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: Access denied for user 'root'@'localhost.localdomain' (using password: YES)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Access denied for user 'root'@'localhost.localdomain' (using password: YES))))
      ObjectName: jboss.mq:service=PersistenceManager
       state: FAILED
       I Depend On: jboss.jca:service=LocalTxCM,name=DefaultDS
      
       Depends On Me: jboss.mq:service=DestinationManager
      javax.management.MBeanException: org.jboss.mq.SpyJMSException: Could not get a connection for jdbc2 table construction ; - nested throwable: (org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: Access denied for user 'root'@'localhost.localdomain' (using password: YES)); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Access denied for user 'root'@'localhost.localdomain' (using password: YES))))
      


      Of course mysqld is running and I can connect to it using 'mysql -u root -p'.

      In Wiki page http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAMysqlDatasource I found that there's an issue with RedHat's systems.

      Please, how can I solve this problem?

      I would like to deploy EJBs to this server with local mysql database running.

      Thank you.

        • 1. Re: Fedora,JBoss 3.2.7, MySQL 4.1.2 Access denied
          darranl

          You need to read the MySQL documentation and look at how to grant users access to your database.

          It is possible that the root account has not been given permission to connect over TCP/IP.

          • 2. Re: Fedora,JBoss 3.2.7, MySQL 4.1.2 Access denied
            mlibra

            In mysql console I called:
            GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'mySecret' WITH GRANT OPTION;

            flush privileges;

            Unfortunately the JBoss still can't properly boot.

            As I read in MySQL documentation, the TCP connection is prefered and used SHOULD be used by 'mysql' command too.

            Thank you.

            • 3. Re: Fedora,JBoss 3.2.7, MySQL 4.1.2 Access denied
              mlibra

              Solved.

              I was wrong when thinking about using TCP connection by 'mysql' utility. In fact it primary uses the unix socket.

              After correct handling the mysql.user table, the boot process finishes without any exception.

              • 4. Re: Fedora,JBoss 3.2.7, MySQL 4.1.2 Access denied
                timcoat

                I have the exact same problem. However, I don't know enough about MySQL to do as mlibra insinuated. If mlibra would be so kind as to post a detail of what was done to correct the issue I would appreciate it very much.

                • 5. Re: Fedora,JBoss 3.2.7, MySQL 4.1.2 Access denied
                  mlibra

                  Testing of correct setting you can do on localhost by invoking:
                  mysql -u somebody-p -h 127.0.0.0.1
                  The -h option is important.

                  Modify the 'mysql.user' table using mysql user 'root'. The user somebody should have enough privileges (for example everywhere 'Y'). It's important to specify network location in mysql.user.Host column, insecure but useful is the value '%' . With this value the user somebody can login from everywhere.

                  Check the value in Password column. You can obtain the crypted value by the password(string) MySQL function.

                  Call the command 'flush privileges;' at the end of modifying of mysql.user table .

                  Everything should be OK now.

                  Marek