5 Replies Latest reply on Aug 29, 2014 5:04 PM by gastaldi

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

    gerry.matte

      I am using forge 2.8.0.Final on a Windows 7 PC with Oracle Java 1.7.0_67.  I am using forge as a command line utility in a windows command window.

      The database I am connecting to is MySQL with InnoDB.

       

      I am now able to generate JPA entities from the database using the jpa-generate-entities-from-tables if I specify all of the database connection parameters as part of the jpa-generate-entities-from-tables command.

      I would like to use the connection-create-profile command followed by a jpa-generate-entities-from-tables that references the connection and does not include all of the database connection info stored in the forge connection.

       

      My connection is created without error:

      [$code]$ 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]$

       

      But when I try use the connection with a jpa-generate-entities-from-tables it appears that the database password was not saved in the connection:

      [persistence.xml]$ 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 matteg the same error occurs.

       

      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.

        • 1. Re: [forge-users] connection-create-profile fails to retain the database connection password
          gastaldi

          Could you please open a JIRA with these steps and then we can have a

          look at it?

           

          Thanks

           

          On 08/28/2014 04:34 PM, forge-users@lists.jboss.org wrote:

          I am using forge 2.8.0.Final on a Windows 7 PC with Oracle Java 1.7.0_67.  I am using forge as a command line utility in a windows command window.

          The database I am connecting to is MySQL with InnoDB.

           

          I am now able to generate JPA entities from the database using the jpa-generate-entities-from-tables if I specify all of the database connection parameters as part of the jpa-generate-entities-from-tables command.

          I would like to use the connection-create-profile command followed by a jpa-generate-entities-from-tables that references the connection and does not include all of the database connection info stored in the forge connection.

           

          My connection is created without error:

          $ project-new --named par --topLevelPackage ca.gerrymatte.par --type war --finalName par ;

          **SUCCESS** Project named 'par' has been created.

          $ jpa-setup --provider Hibernate --dbType MYSQL5_INNODB --container JBOSS_AS7 --dataSourceName java:jboss/datasources/parDS ;

          **SUCCESS** Persistence (JPA) is installed.

          $ 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

          $

           

          But when I try use the connection with a jpa-generate-entities-from-tables it appears that the database password was not saved in the connection:

          $ 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 matteg the same error occurs.

           

          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.

           

          Posted by forums

          Original post: https://developer.jboss.org/message/902315#902315

           

          _______________________________________________

          forge-users mailing list

          forge-users@lists.jboss.org

          https://lists.jboss.org/mailman/listinfo/forge-users

           

          _______________________________________________

          forge-users mailing list

          forge-users@lists.jboss.org

          https://lists.jboss.org/mailman/listinfo/forge-users

           

          • 3. Re: connection-create-profile fails to retain the database connection password
            gastaldi

            Hi Gerry,

             

            I just fixed your issue. It should be available in the next released version (1.8.2.Final), which is due in Sept, 15th.

            You can build from the master branch if you like.

             

            Best Regards,

             

            George Gastaldi

            • 4. Re: connection-create-profile fails to retain the database connection password
              gerry.matte

              I believe you meant version 2.8.2 contains the fix.

              Thank you .

              • 5. Re: [forge-users] connection-create-profile fails to retain the      database connection password
                gastaldi

                Ah yes, sorry, got distracted while writing the post

                 

                Em 29/08/2014, às 17:47, forge-users@lists.jboss.org escreveu:

                 

                I believe you meant version 2.8.2 contains the fix.

                Thank you .

                 

                Posted by forums

                Original post: https://developer.jboss.org/message/902490#902490

                _______________________________________________

                forge-users mailing list

                forge-users@lists.jboss.org

                https://lists.jboss.org/mailman/listinfo/forge-users

                 

                _______________________________________________

                forge-users mailing list

                forge-users@lists.jboss.org

                https://lists.jboss.org/mailman/listinfo/forge-users