2 Replies Latest reply on Aug 31, 2009 11:33 PM by Paul Meehan

    seam-gen and hibernate

    Paul Meehan Newbie
      Hi

      I am using Dan Allens book (Seam in Action) and have been following the
      instructions to get seam-gen going. I have hit an error in 'seam
      generate' related to Hibernate and I am unsure of how to troubleshoot
      it. If anyone has any ideas I would appreciate it. Find below the output:


      C:\Documents and Settings\paulmeehan\My
      Documents\Development\jboss-seam-2.2.0.GA>seam generate
      SEAM_HOME: C:\Documents and Settings\paulmeehan\My
      Documents\Development\jboss-seam-2.2.0.GA
      Using seam-gen sources from: C:\Documents and Settings\paulmeehan\My
      Documents\Development\jboss-seam-2.2.0.GA\seam-gen
      Buildfile: C:\Documents and Settings\paulmeehan\My
      Documents\Development\jboss-seam-2.2.0.GA\seam-gen\build.xml

      init:

      init-properties:
          [echo] C:/Documents and Settings/paulmeehan/My
      Documents/Development/jboss-4.2.2.GA

      validate-workspace:

      validate-project:

      init-generate:

      generate-model:
          [echo] Reverse engineering database using JDBC driver C:Documents
      and SettingspaulmeehanMy DocumentsDevelopmentseaminactionli
      ar
          [echo] project=c:/Documents and Settings/paulmeehan/My
      Documents/Development/open18
          [echo] model=com.mydomain.open18.model
      [hibernate] Executing Hibernate Tool with a JDBC Configuration (for
      reverse engineering)
      [hibernate] 1. task: hbm2java (Generates a set of .java files)
      [hibernate] log4j:WARN No appenders could be found for logger
      (org.hibernate.cfg.Environment).
      [hibernate] log4j:WARN Please initialize the log4j system properly.
      [hibernate] An exception occurred while running exporter #2:hbm2java
      (Generates a set of .java files)
      [hibernate] To get the full stack trace run ant with -verbose
      [hibernate] org.hibernate.HibernateException: JDBC Driver class not
      found: org.h2.Driver
      [hibernate] java.lang.ClassNotFoundException: org.h2.Driver
      [hibernate] A class were not found in the classpath of the Ant task.
      [hibernate] Ensure that the classpath contains the classes needed for
      Hibernate and your code are in the classpath.

      BUILD FAILED
      C:\Documents and Settings\paulmeehan\My
      Documents\Development\jboss-seam-2.2.0.GA\seam-gen\build.xml:1564:
      org.hibernate.Hibernate
      tion: JDBC Driver class not found: org.h2.Driver||
        • 1. Re: seam-gen and hibernate
          Arbi Sookazian Master

          seam-gen uses hbm2java (one of the Hibernate Tools) under the covers for the revengr procedure.


          You need to make sure that in the 'seam setup' task you specify the correct location of the correct driver and the JDBC driver class that Hibernate should use.


          In %SEAM_HOME%\seam-gen\build.properties files, these are the relevant entries that are saved during the 'seam setup' task:


          hibernate.connection.driver_class=com.microsoft.sqlserver.jdbc.SQLServerDriver
          driver.jar=../lib/sqljdbc.jar



          double-check that these exist and are correct for your particular db.

          • 2. Re: seam-gen and hibernate
            Paul Meehan Newbie

            Thanks for your reply. The entries I had in the build.properties file were in fact correct  but what was causing the problem was a path specified with backslashes instead of forward slashes (I am on Windows). Thanks!