10 Replies Latest reply on Feb 15, 2002 12:04 AM by Tim Batchelor

    error on startup with mySQL as DataSource

    Dan Harfleet Newbie

      Hi,

      I am trying to set up DataSources, in this case to use with CMP, but I may want to use it with BMP in the future.

      I am using the example .jcml entries from the manual at:

      http://www.jboss.org/online-manual/HTML/ch04s11.html

      I am using:
      jboss 2.2.2 with tomcat 3.2.2 (bundled)
      mySQL 3.23.30 for windows
      mysql_uncomp.jar is in jboss/lib/ext
      os = windows me 4.90.3000 (unfortunately ;-) )

      I have successfully used a jdbc connection from a standalone client and from a servlet in Tomcat.
      I am now getting an error when starting jboss. I read in the forum that someone using linux had a proble such that they needed to include the domain in the database url. Maybe this is why I have a problem ??
      The relevant parts of my server.log file are:

      [JDBC provider] Initializing
      [JDBC provider] Loaded JDBC-driver:org.gjt.mm.mysql.Driver
      [JDBC provider] Loaded JDBC-driver:org.hsql.jdbcDriver
      [JDBC provider] Loaded JDBC-driver:org.enhydra.instantdb.jdbc.idbDriver
      [JDBC provider] Initialized
      .
      .
      .
      [InstantDB] Started
      [DefaultDS] Starting
      [DefaultDS] XA Connection pool DefaultDS bound to java:/DefaultDS
      [DefaultDS] Started
      [MYSQLDS] Starting
      [MYSQLDS] XA Connection pool MYSQLDS bound to java:/MYSQLDS
      [MYSQLDS] Stopped
      [MYSQLDS] java.lang.NullPointerException
      [MYSQLDS] at org.opentools.minerva.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:165)
      [MYSQLDS] at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:330)
      [MYSQLDS] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:93)
      [MYSQLDS] at java.lang.reflect.Method.invoke(Native Method)
      [MYSQLDS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [MYSQLDS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [MYSQLDS] at org.jboss.util.ServiceControl.start(ServiceControl.java:97)
      [MYSQLDS] at java.lang.reflect.Method.invoke(Native Method)
      [MYSQLDS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [MYSQLDS] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [MYSQLDS] at org.jboss.Main.(Main.java:217)
      [MYSQLDS] at org.jboss.Main$1.run(Main.java:121)
      [MYSQLDS] at java.security.AccessController.doPrivileged(Native Method)
      [MYSQLDS] at org.jboss.Main.main(Main.java:117)
      [Service Control] Could not start DefaultDomain:service=XADataSource,name=MYSQLDB
      [Service Control] java.lang.NullPointerException
      [Service Control] at org.opentools.minerva.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:165)
      [Service Control] at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:330)
      [Service Control] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:93)
      [Service Control] at java.lang.reflect.Method.invoke(Native Method)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Service Control] at org.jboss.util.ServiceControl.start(ServiceControl.java:97)
      [Service Control] at java.lang.reflect.Method.invoke(Native Method)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Service Control] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Service Control] at org.jboss.Main.(Main.java:217)
      [Service Control] at org.jboss.Main$1.run(Main.java:121)
      [Service Control] at java.security.AccessController.doPrivileged(Native Method)
      [Service Control] at org.jboss.Main.main(Main.java:117)
      [Container factory] Starting




      My jcml file is like this:
      (I have also tried using some extra attributes as mentioned on a previous post; this has not helped)

      <!-- JDBC -->

      org.gjt.mm.mysql.Driver,org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver


      [hypersonic edited out]
      [InstantDB edited out]
      [Default DS edited out]

      <!-- string used with jdbc standalone test... jdbc:mysql://localhost/test2?user=auth=auth -->

      <!-- this is as per the manual

      org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl
      mySQLDS
      jdbc:mysql://localhost/test2
      auth
      auth

      -->
      <!-- try using extra attributes -->

      MYSQLDS
      org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl

      jdbc:mysql://localhost/test2
      1200000
      auth
      10
      auth
      false
      false
      false
      false
      120000
      1800000
      false
      false
      1.0
      0


      thanks for any future help,

      dan

        • 1. Re: error on startup with mySQL as DataSource
          raghav Newbie

          hai ,

          try with this option:
          copy the mysql.jar to JBOSS/lib/ext directory.
          U can get mysql.jar from serverside.com
          all the best

          • 2. Re: error on startup with mySQL as DataSource
            Dan Harfleet Newbie

            Hi Raghav,

            I have the mysql_uncomp.jar in jboss/lib/ext, this is the driver as developed by Mark Matthews (see http://www.mysql.com/downloads/api-jdbc.html). I have downloaded the latest stable version, this makes no difference to the error. I have searched theserverside.com for mysql.jar, but can't find it,
            thanks for your help,

            dan

            ......

            does anyone else have any idea what is the problem ? It seems a shame that I can't use an open source db with an open source app server

            dan

            • 3. Re: error on startup with mySQL as DataSource
              Allen Fogleson Newbie

              you can try putting the port in the url... I think it should work without it, not sure, since I always change my DB's to not run on the default port and hence have to have it there. It's worth a try anyway.

              Al

              • 4. Re: error on startup with mySQL as DataSource
                Dan Harfleet Newbie

                Thanks Al, but already tried that, just for info I also tried removing the username and password attributes and adding the username and password to the url as params.

                Does anyone know anything about the security policies in JBoss and what policy I should be using if not the default. I have had a connection to mySQL, but only through a stateless session bean and not using the DataSource, just using basic jdbc classforname instantiation,
                dan

                • 5. Re: error on startup with mySQL as DataSource
                  Alex Pavlov Newbie

                  Hi Dan,
                  change line
                  false

                  from false to true and see more detailed report,
                  it seems you have problem with authorization/or with connection parameters.
                  Alex.

                  • 6. Re: error on startup with mySQL as DataSource
                    Ignacio Newbie

                    Ok, I will say those ones that haven't been said yet:

                    1) Is your database up and running?
                    2) Can you connect with the same params from the mysql client? Try to query the database to be sure
                    3) Can you make a simple dummy program that connect to the database and query any table?

                    FWIW, try to keep the port number on the URL.

                    My version of the jar is mm.mysql-2.0.4-bin.jar and works fine.

                    • 7. Re: error on startup with mySQL as DataSource
                      Dan Harfleet Newbie

                      Hi All,

                      I have resolved this problem. As some people suspected it was a problem with my mySQL privliges. I created a new user in mySQL called jboss and it worked. I then compared the priviliges for auth (my original user) and jboss(the user) and found that auth only had "%" where as jboss had "%" and "localhost", from what I can read from the mySQL manual "%" is remote and "localhost" is obviously local. I wrongly assumed if you had "%" you would also have "localhost" by default.

                      I also did what one of you said and switched the logging on, this showed that JBoss(the server) was having a problem connecting to mySQL with a password of 'YES' I don't know where this comes from, but as it also happens in my mysqlgui tool when I use an incorrect password, I assume its a mySQL thing.

                      The interesting thing is that JBoss didn't have a problem when I used a class for name with the driver and connected from within a session bean.

                      Anyway I have other work to get on with over the next couple of days, but intend to post a more detailed explanation (for people with similar problems) over the weekend.

                      Also, I think if anyone has good mySQL admin knowledge, it would be userful to have a set of steps to take with mySQL when setting up JBoss CMP,

                      thanks again,

                      dan

                      • 8. Re: error on startup with mySQL as DataSource
                        Aqil Newbie

                        Yes "mySQL admin"--- this is the place where problem lies, and we have so many threads regarding "mySQL not connecting to Jboss".phpMyAdmin gives excellent way to see System variables+Users+everything of mySQL.Plz guide what should be there to properly connect mySQL with jboss.In my case i connect jsp/servlets with mySql without any problem (jdbc:mysql://localhost:3306/test", "","")obviously i connect without any user/password ,but when i connect jboss with mySQL , driver gets loaded perfectly but jboss dont connect with mySQL......i'm sure this is same "jboss Admin" issue .....

                        • 9. Re: error on startup with mySQL as DataSource
                          lizhi2002 Newbie

                          I meet the error too.

                          • 10. Re: error on startup with mySQL as DataSource
                            Tim Batchelor Newbie

                            I set an environment variable
                            USER=tim

                            then it worked.