Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1990

connection-create-profile fails to retain the database connection password

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.9.2.Final
    • 2.8.0.Final
    • Database Tools
    • None
    • Hide

      1. Create a new project, setup jpa, and create a connection profile:

      $ project-new --named par --topLevelPackage ca.gerrymatte.par --type war --finalName par ;
      ***SUCCESS*** Project named 'par' has been created.
      [par]$ jpa-setup --provider Hibernate --dbType MYSQL5_INNODB --container JBOSS_AS7 --dataSourceName java:jboss/datasources/parDS ;
      ***SUCCESS*** Persistence (JPA) is installed.
      [persistence.xml]$ connection-create-profile - --name parConnection --hibernateDialect MySQL5\ with\ InnoDB\ :\ org.hibernate.dialect.MySQL5InnoDBDialect --driverClass com.mysql.jdbc.Driver
      --driverLocation C:/s/jclasses/drivers/mysql.jar --userName root --userPassword xxxxxx --jdbcUrl jdbc:mysql:///par?characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=tru
      e&zeroDateTimeBehavior=convertToNull --verifyConnection true;
      ***SUCCESS*** Connection profile parConnection has been saved successfully
      [persistence.xml]$
      

      2. Try to generate the entities using the connection profile:

      jpa-generate-entities-from-tables - --databaseTables * --connectionProfile parConnection --targetPackage ca.gerrymatte.par.model ;
      org.hibernate.exception.GenericJDBCException: Getting database metadata
              at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
              at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.getMetaData(AbstractMetaDataDialect.java:63)
              at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.caseForSearch(AbstractMetaDataDialect.java:163)
              at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:22)
              at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:476)
              at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:74)
              at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:860)
              at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:120)
              at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:93)
              at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:43)
              at org.jboss.forge.addon.database.tools.util.HibernateToolsHelper$1.run(HibernateToolsHelper.java:27)
              at org.jboss.forge.addon.database.tools.util.UrlClassLoaderExecutor.execute(UrlClassLoaderExecutor.java:15)
              at org.jboss.forge.addon.database.tools.util.HibernateToolsHelper.buildMappings(HibernateToolsHelper.java:17)
              at org.jboss.forge.addon.database.tools.generate.DatabaseTableSelectionStep$1.call(DatabaseTableSelectionStep.java:96)
              at org.jboss.forge.addon.database.tools.generate.DatabaseTableSelectionStep$1.call(DatabaseTableSelectionStep.java:86)
              at org.jboss.forge.furnace.util.Callables.call(Callables.java:43)
              at org.jboss.forge.addon.ui.impl.input.AbstractUISelectInputComponent.getValueChoices(AbstractUISelectInputComponent.java:55)
              at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor$1.call(ClassLoaderInterceptor.java:87)
              at org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:40)
              at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor.invoke(ClassLoaderInterceptor.java:103)
              at org.jboss.forge.addon.facets.AbstractFaceted_$$_javassist_4b59101b-4f6a-4fb6-9e4d-7267a243a3dd.getValueChoices(AbstractFaceted_$$_javassist_4b59101b-4f6a-4fb6-9e4d-7267a243a3dd.ja
      va)
              at org.jboss.forge.addon.shell.aesh.CommandLineUtil.resolveWildcardSelectOptionValues(CommandLineUtil.java:208)
              at org.jboss.forge.addon.shell.aesh.CommandLineUtil.populateUIInputs(CommandLineUtil.java:183)
              at org.jboss.forge.addon.shell.aesh.ShellWizard.populate(ShellWizard.java:57)
              at org.jboss.forge.addon.shell.aesh.ShellWizard.populate(ShellWizard.java:81)
              at org.jboss.forge.addon.shell.aesh.ShellWizard.getParser(ShellWizard.java:44)
              at org.jboss.forge.addon.shell.aesh.ForgeCommandRegistry.getForgeCommand(ForgeCommandRegistry.java:110)
              at org.jboss.forge.addon.shell.aesh.ForgeCommandRegistry.getCommand(ForgeCommandRegistry.java:77)
              at org.jboss.aesh.console.AeshConsoleImpl.getCommand(AeshConsoleImpl.java:242)
              at org.jboss.aesh.console.AeshConsoleImpl.access$100(AeshConsoleImpl.java:51)
              at org.jboss.aesh.console.AeshConsoleImpl$AeshConsoleCallbackImpl.execute(AeshConsoleImpl.java:304)
              at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:40)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164)
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:926)
              at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1748)
              at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1288)
              at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2506)
              at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539)
              at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)
              at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)
              at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
              at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
              at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
              at org.jboss.forge.addon.database.tools.util.DelegatingDriver.connect(DelegatingDriver.java:25)
              at java.sql.DriverManager.getConnection(DriverManager.java:571)
              at java.sql.DriverManager.getConnection(DriverManager.java:187)
              at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
              at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.getConnection(AbstractMetaDataDialect.java:121)
              at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.getMetaData(AbstractMetaDataDialect.java:60)
              ... 36 more
      ***ERROR*** Database Tables must be specified.
      

      If I repeat the command and I insert the password at the end with --userPassword xxxxx the same error occurs.

      Show
      1. Create a new project, setup jpa, and create a connection profile: $ project- new --named par --topLevelPackage ca.gerrymatte.par --type war --finalName par ; ***SUCCESS*** Project named 'par' has been created. [par]$ jpa-setup --provider Hibernate --dbType MYSQL5_INNODB --container JBOSS_AS7 --dataSourceName java:jboss/datasources/parDS ; ***SUCCESS*** Persistence (JPA) is installed. [persistence.xml]$ connection-create-profile - --name parConnection --hibernateDialect MySQL5\ with\ InnoDB\ :\ org.hibernate.dialect.MySQL5InnoDBDialect --driverClass com.mysql.jdbc.Driver --driverLocation C:/s/jclasses/drivers/mysql.jar --userName root --userPassword xxxxxx --jdbcUrl jdbc:mysql: ///par?characterEncoding=UTF-8&amp;characterSetResults=UTF-8&amp;autoReconnect=tru e&amp;zeroDateTimeBehavior=convertToNull --verifyConnection true ; ***SUCCESS*** Connection profile parConnection has been saved successfully [persistence.xml]$ 2. Try to generate the entities using the connection profile: jpa-generate-entities-from-tables - --databaseTables * --connectionProfile parConnection --targetPackage ca.gerrymatte.par.model ; org.hibernate.exception.GenericJDBCException: Getting database metadata at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.getMetaData(AbstractMetaDataDialect.java:63) at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.caseForSearch(AbstractMetaDataDialect.java:163) at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:22) at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:476) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:74) at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:860) at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:120) at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:93) at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:43) at org.jboss.forge.addon.database.tools.util.HibernateToolsHelper$1.run(HibernateToolsHelper.java:27) at org.jboss.forge.addon.database.tools.util.UrlClassLoaderExecutor.execute(UrlClassLoaderExecutor.java:15) at org.jboss.forge.addon.database.tools.util.HibernateToolsHelper.buildMappings(HibernateToolsHelper.java:17) at org.jboss.forge.addon.database.tools.generate.DatabaseTableSelectionStep$1.call(DatabaseTableSelectionStep.java:96) at org.jboss.forge.addon.database.tools.generate.DatabaseTableSelectionStep$1.call(DatabaseTableSelectionStep.java:86) at org.jboss.forge.furnace.util.Callables.call(Callables.java:43) at org.jboss.forge.addon.ui.impl.input.AbstractUISelectInputComponent.getValueChoices(AbstractUISelectInputComponent.java:55) at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor$1.call(ClassLoaderInterceptor.java:87) at org.jboss.forge.furnace.util.ClassLoaders.executeIn(ClassLoaders.java:40) at org.jboss.forge.furnace.proxy.ClassLoaderInterceptor.invoke(ClassLoaderInterceptor.java:103) at org.jboss.forge.addon.facets.AbstractFaceted_$$_javassist_4b59101b-4f6a-4fb6-9e4d-7267a243a3dd.getValueChoices(AbstractFaceted_$$_javassist_4b59101b-4f6a-4fb6-9e4d-7267a243a3dd.ja va) at org.jboss.forge.addon.shell.aesh.CommandLineUtil.resolveWildcardSelectOptionValues(CommandLineUtil.java:208) at org.jboss.forge.addon.shell.aesh.CommandLineUtil.populateUIInputs(CommandLineUtil.java:183) at org.jboss.forge.addon.shell.aesh.ShellWizard.populate(ShellWizard.java:57) at org.jboss.forge.addon.shell.aesh.ShellWizard.populate(ShellWizard.java:81) at org.jboss.forge.addon.shell.aesh.ShellWizard.getParser(ShellWizard.java:44) at org.jboss.forge.addon.shell.aesh.ForgeCommandRegistry.getForgeCommand(ForgeCommandRegistry.java:110) at org.jboss.forge.addon.shell.aesh.ForgeCommandRegistry.getCommand(ForgeCommandRegistry.java:77) at org.jboss.aesh.console.AeshConsoleImpl.getCommand(AeshConsoleImpl.java:242) at org.jboss.aesh.console.AeshConsoleImpl.access$100(AeshConsoleImpl.java:51) at org.jboss.aesh.console.AeshConsoleImpl$AeshConsoleCallbackImpl.execute(AeshConsoleImpl.java:304) at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:40) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang. Thread .run( Thread .java:745) Caused by: java.sql.SQLException: Access denied for user 'root' @ 'localhost' (using password: NO) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1084) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4232) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4164) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:926) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1748) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1288) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2506) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:409) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344) at org.jboss.forge.addon.database.tools.util.DelegatingDriver.connect(DelegatingDriver.java:25) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:187) at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133) at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.getConnection(AbstractMetaDataDialect.java:121) at org.hibernate.cfg.reveng.dialect.AbstractMetaDataDialect.getMetaData(AbstractMetaDataDialect.java:60) ... 36 more ***ERROR*** Database Tables must be specified. If I repeat the command and I insert the password at the end with --userPassword xxxxx the same error occurs.

      When creating a new project, I successfully created a connection profile for the database. When I attempted to use that connection with the command jpa-generate-entities-from-tables, an exception was thrown indicating that the userPassword was unknown - even though it was specified when the connection was created. There was also an error message indicating that Database Tables must be specified.

      The full commands are noted in steps to reproduce.

      I am currently able to generate my entities without using a forge connection profile but if the connection info is persistent within the project, or is globally persistent across multiple projects, it would be much more desirable to use connection profiles for each of my database schema.

              rhn-support-ggastald George Gastaldi
              gerry.matte_jira Gerry Matte (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: