2 Replies Latest reply on Mar 26, 2009 9:55 AM by John Smola

    Got SQLException during generate-entities

    John Smola Newbie

      Hello.
      When I use seam generate-entities I get
      java.sql.SQLException: No suitable driver
      I use Seam 2.1.1GA JBossAS 5.0.1GA. Database PostgreSQL.


      Usually this exception occurs because of wrong connection string, but my connection string is ok. I check it via Eclipse Seam Tools. (I press button test connection and get message Ping succeded).


      Here is my hibernate-console.properties:



      #File used by hibernate tools to override <datasource> and other container specific settings in persistence.xml
      hibernate.connection.password=9116485
      hibernate.connection.username=postgres
      hibernate.connection.driver_class=org.postgresql.Driver
      hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
      hibernate.connection.url=jdbc\:postgresql\://localhost\:5432/test
      
      hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
      hibernate.datasource=
      hibernate.transaction.manager_lookup_class=
      


      Here is seam-gen.properties:


      #Generated by seam setup
      #Tue Mar 24 16:57:13 EET 2009
      hibernate.connection.password=9116485
      workspace.home=D\:/seam/ws
      model.package=com.adminko.entity
      driver.jar=d\:\\seam\\lib\\postgresql-8.3-604.jdbc3.jar
      action.package=com.adminko.session
      test.package=com.adminko.test
      database.type=postgres
      richfaces.skin=classic
      hibernate.default_catalog.null=
      hibernate.default_schema.null=
      database.drop=n
      project.name=adminko
      hibernate.connection.username=postgres
      hibernate.connection.driver_class=org.postgresql.Driver
      hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
      project.type=ear
      icefaces.home=
      database.exists=y
      jboss.home=D\:/seam/jboss-5.0.1.GA
      hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
      hibernate.connection.url=jdbc\:postgres\:test
      icefaces=n



      My stacktrace:


      [hibernate] 25.03.2009 11:12:48 org.hibernate.connection.DriverManagerConnectionProvider configure
      [hibernate] INFO: connection properties: {user=postgres, password=****}
      [hibernate] 25.03.2009 11:12:48 org.hibernate.cfg.SettingsFactory buildSettings
      [hibernate] WARNING: Could not obtain connection metadata
      [hibernate] java.sql.SQLException: No suitable driver
      [hibernate]     at java.sql.DriverManager.getConnection(DriverManager.java:545)
      [hibernate]     at java.sql.DriverManager.getConnection(DriverManager.java:140)
      [hibernate]     at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnect
      ionProvider.java:110)
      [hibernate]     at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
      [hibernate]     at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2005)
      [hibernate]     at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40)
      
      [hibernate]     at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConfigurationTask.java:81)
      
      [hibernate]     at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
      [hibernate]     at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:302)
      [hibernate]     at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolTask.java:318)
      [hibernate]     at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.java:94)
      [hibernate]     at org.hibernate.tool.ant.Hbm2JavaExporterTask.configureExporter(Hbm2JavaExporterTask.java:34)
      
      [hibernate]     at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
      [hibernate]     at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
      [hibernate]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      [hibernate]     at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      [hibernate]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      [hibernate]     at java.lang.reflect.Method.invoke(Method.java:585)
      [hibernate]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
      [hibernate]     at org.apache.tools.ant.Task.perform(Task.java:348)
      [hibernate]     at org.apache.tools.ant.Target.execute(Target.java:357)
      [hibernate]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
      [hibernate]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
      [hibernate]     at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
      [hibernate]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      [hibernate]     at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
      [hibernate]     at org.apache.tools.ant.Main.runBuild(Main.java:698)
      [hibernate]     at org.apache.tools.ant.Main.startAnt(Main.java:199)
      [hibernate]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      [hibernate]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
      [hibernate] 25.03.2009 11:12:49 org.hibernate.dialect.Dialect <init>
      [hibernate] INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
      [hibernate] 25.03.2009 11:12:49 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
      [hibernate] INFO: Using default transaction strategy (direct JDBC transactions)
      [hibernate] 25.03.2009 11:12:49 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManage
      rLookup
      [hibernate] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transaction
      al second-level cache is not recommended)
      [hibernate] 25.03.2009 11:12:49 org.hibernate.cfg.SettingsFactory buildSettings




      I googled this exception, and I found few similar questions, but no answers.
      I tried to put postgresql-8.3-604.jdbc3.jar driver into classpath, into SEAM-HOME/lib, but this was no help at all.


      Please, help.