3 Replies Latest reply on Apr 9, 2009 11:57 PM by gbadavidson

    "Could not obtain connection metadata' when generating Hiber

    gbadavidson

      I am attempting to use Hibernate with JSF/Facelets on the JBoss AS. When the application attempts to build the Hibernate Session Factory an error is thrown "Could not obtain connection metadata", yet the driver is listed a few lines eariler in the log. Here is the relevent lines from the log and then the Hibernate configuration file. :


      
      10:13:20,146 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
      10:13:20,146 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
      10:13:20,209 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Phone.hbm.xml
      10:13:20,287 INFO [HbmBinder] Mapping class: person.Phone -> phone
      10:13:20,302 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personrolexref.hbm.xml
      10:13:20,302 INFO [HbmBinder] Mapping class: person.Personrolexref -> personrolexref
      10:13:20,302 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personaddressxref.hbm.xml
      10:13:20,334 INFO [HbmBinder] Mapping class: person.Personaddressxref -> personaddressxref
      10:13:20,334 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Role.hbm.xml
      10:13:20,334 INFO [HbmBinder] Mapping class: person.Role -> role
      10:13:20,334 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Person.hbm.xml
      10:13:20,349 INFO [HbmBinder] Mapping class: person.Person -> person
      10:13:20,349 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Address.hbm.xml
      10:13:20,349 INFO [HbmBinder] Mapping class: person.Address -> address
      10:13:20,349 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personcoursexref.hbm.xml
      10:13:20,365 INFO [HbmBinder] Mapping class: person.Personcoursexref -> personcoursexref
      10:13:20,365 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/person/Personphonexref.hbm.xml
      10:13:20,365 INFO [HbmBinder] Mapping class: person.Personphonexref -> personphonexref
      10:13:20,365 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Coursecategoryxref.hbm.xml
      10:13:20,365 INFO [HbmBinder] Mapping class: course.Coursecategoryxref -> coursecategoryxref
      10:13:20,365 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Course.hbm.xml
      10:13:20,380 INFO [HbmBinder] Mapping class: course.Course -> course
      10:13:20,380 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Courseprogresshistory.hbm.xml
      10:13:20,380 INFO [HbmBinder] Mapping class: course.Courseprogresshistory -> courseprogresshistory
      10:13:20,380 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Category.hbm.xml
      10:13:20,396 INFO [HbmBinder] Mapping class: course.Category -> category
      10:13:20,396 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Visibility.hbm.xml
      10:13:20,396 INFO [HbmBinder] Mapping class: course.Visibility -> visibility
      10:13:20,396 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Slide.hbm.xml
      10:13:20,412 INFO [HbmBinder] Mapping class: course.Slide -> slide
      10:13:20,412 INFO [Configuration] Reading mappings from resource : com/bellecrestsoftware/course/Rating.hbm.xml
      10:13:20,412 INFO [HbmBinder] Mapping class: course.Rating -> rating
      10:13:20,412 INFO [Configuration] Configured SessionFactory: null
      10:13:20,490 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
      10:13:20,490 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
      10:13:20,490 INFO [DriverManagerConnectionProvider] autocommit mode: false
      10:13:20,505 INFO [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/MiracleMind
      10:13:20,505 INFO [DriverManagerConnectionProvider] connection properties: {user=root, password=root}
      10:13:20,505 WARN [SettingsFactory] Could not obtain connection metadata
      java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/MiracleMind
       at java.sql.DriverManager.getConnection(Unknown Source)
       at java.sql.DriverManager.getConnection(Unknown Source)
       at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2063)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1298)
       at com.bellecrestsoftware.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)
       at com.bellecrestsoftware.hibernate.BaseHibernateDAO.getSession(BaseHibernateDAO.java:13)
       at com.bellecrestsoftware.person.PersonDAO.findByProperty(PersonDAO.java:89)
      
      
      
      
      <!DOCTYPE hibernate-configuration PUBLIC
       "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
       "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
      
      <!-- Generated by MyEclipse Hibernate Tools. -->
      <hibernate-configuration>
      
       <session-factory>
       <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
       <property name="connection.username">root</property>
       <property name="connection.url">
       jdbc:mysql://localhost:3306/MiracleMind
       </property>
       <property name="dialect">
       org.hibernate.dialect.MySQLDialect
       </property>
       <property name="myeclipse.connection.profile">
       New MySQL
       </property>
       <property name="hbm2ddl.auto">update</property>
       <property name="connection.password">root</property>
       <property name="connection.driver_class">
       com.mysql.jdbc.Driver
       </property>
      
       <mapping resource="com/bellecrestsoftware/person/Phone.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Personrolexref.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Personaddressxref.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Role.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Person.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Address.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Personcoursexref.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/person/Personphonexref.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Coursecategoryxref.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Course.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Courseprogresshistory.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Category.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Visibility.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Slide.hbm.xml" />
       <mapping resource="com/bellecrestsoftware/course/Rating.hbm.xml" />
      
       </session-factory>
      
      </hibernate-configuration>


        • 1. Re: No Suitable Driver found
          gbadavidson

          I have deleted the original Mysql Driver files and configurations and regenerated them. I am getting the same results. If anyone has any suggestions please let me know. If someone has a link to some documentyation for configuring Hibernate in Jboss developer studio that they found helpful it would be greatly appreciated. I haven't found much documentation.

          • 2. Re:
            peterj

            Is the mysql JAR file in the server/xxx/lib directory?

            • 3. Re:
              gbadavidson

              Peter,

              Thanks, right on the money. I did not have the jar file in the right lib directory. After I placed the My connector jar file in there the driver problem was cleared. I now have a Jndi naming problem but I am going to see if I can figure that out with having to bother you guys!! Thanks for your help!!!!