Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Eclipse Hibernate Connection Password Issue Reverse Code Gen
PostPosted: Tue Feb 14, 2017 2:47 am 
Newbie

Joined: Wed Feb 08, 2017 5:25 pm
Posts: 1
I'm having issues with connection to the MySQL database caused by some configuration I'm unable to locate to correct the problem.
I was able to get the connection to the MySQL DB via Hibernate in Eclipse to work, I execute the Reverse Code Generation of the POJO, it then stopped working. I then had an unable to connect to db error. I could not figure out what broke or how to fix it. Strange how it works and then stops working, something in Eclipse must be getting generated and it somehow breaks the ability to connect to the db.

I created a new eclipse workspace and was able to get it working in that new environment.
Comparing the two projects/workspaces I noticed one small different between the two projects.
In broken one I went to Hibernate perspective and the Hibernate Configurations, I selected the Configuration and in the Properties listing, hibernate.connection.password has a Value of **** while in the one that is working the **** is the actual password.

Can't figure out how the hibernate.connection.password property is getting set correctly with the password in one case and with **** in the other case. If you know how that value is getting set or how to replace the **** with a password that would be great.

Note: it is not coming from hibernate.reveng.xml, hibernate.propoerties, or hibernate.cfg.xml
Switching to JPA perspective, right-clicking on the Database Connections->MySQL DB and selecting properties.
Within the Properties for MySQL DB -> Driver Properties -> Drivers: MySQL JDBC Driver (selected) and General tab.
I can change URL: User name: and Password: values. When I return to the hibernate perspective
and select Hibernate Configurations and Rebuild configuration, the values for hibernate.connection.url|username have updated but the password remains **** and
get the error: org.hibernate.exception.GenericJDBCException: Error calling Driver#connect
java.sql.SQLException: Access denied for user ....


Eclipse is Neon.2
MySQL is 5.6.35
Connector/J is 5.1.40
Hibernate Tools 5.1.2.v20161121-1143 org.hibernate.eclipse.feature.feature.group JBoss by Red Hat

Here are two screen captures
http://www.ecolocate.org/hibernate_1.png
http://www.ecolocate.org/hibernate_2.png

I can't find any place the password is stored in a file (neither the four **** nor the actual password for the one that works)
When in Hibernate perspective, clicking in the Hibernate Configurations window on Rebuild Configuration is the place the configuration is created but it is corrupted at some other point before this, as I just ran the command in the working workspace and the user, url, and password showed up correctly in the configuration.

Here is some extra information from the log.
I think the issue is coming from JDBCMetaDataConfiguration.java line 122 when getProperties() is called. The question is where s getProperties() getting the password and how does it get corrupted in storage sometimes and not others and once corrupted I'm unable to fix it. Must be some encryption storage issue.
https://source.jboss.org/browse/Hiberna ... va?hb=true

Debug log:

Code:
!ENTRY org.hibernate.eclipse 4 666 2017-02-14 11:10:31.796
!MESSAGE org.hibernate.exception.GenericJDBCException: Error calling Driver#connect
!STACK 0
org.hibernate.exception.GenericJDBCException: Error calling Driver#connect
   at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
   at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:118)
   at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
   at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.addConnections(PooledConnections.java:123)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:42)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:20)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:161)
   at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:109)
   at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:72)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
   at org.hibernate.cfg.JDBCReaderFactory.newJDBCReader(JDBCReaderFactory.java:37)
   at org.hibernate.cfg.JDBCReaderFactory.newJDBCReader(JDBCReaderFactory.java:24)
   at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:133)
   at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:110)
   at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:126)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:43)
   at org.jboss.tools.hibernate.runtime.common.AbstractConfigurationFacade.readFromJDBC(AbstractConfigurationFacade.java:208)
   at org.hibernate.eclipse.console.common.ConsoleExtension$2.execute(ConsoleExtension.java:308)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
   at org.hibernate.eclipse.console.common.ConsoleExtension.buildConfiguration(ConsoleExtension.java:266)
   at org.hibernate.eclipse.console.common.ConsoleExtension.runExporters(ConsoleExtension.java:174)
   at org.hibernate.eclipse.console.common.ConsoleExtension.launchExporters(ConsoleExtension.java:110)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:266)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
   at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873)
   at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710)
   at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)
   at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
   at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
   at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
   at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
   at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)
   ... 33 more
!SUBENTRY 1 org.hibernate.eclipse 4 666 2017-02-14 11:10:31.797
!MESSAGE org.hibernate.exception.GenericJDBCException: Error calling Driver#connect
!STACK 0
org.hibernate.exception.GenericJDBCException: Error calling Driver#connect
   at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
   at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
   at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:118)
   at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)
   at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.addConnections(PooledConnections.java:123)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:42)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:20)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:161)
   at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:109)
   at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:72)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
   at org.hibernate.cfg.JDBCReaderFactory.newJDBCReader(JDBCReaderFactory.java:37)
   at org.hibernate.cfg.JDBCReaderFactory.newJDBCReader(JDBCReaderFactory.java:24)
   at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:133)
   at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:110)
   at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:126)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:43)
   at org.jboss.tools.hibernate.runtime.common.AbstractConfigurationFacade.readFromJDBC(AbstractConfigurationFacade.java:208)
   at org.hibernate.eclipse.console.common.ConsoleExtension$2.execute(ConsoleExtension.java:308)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
   at org.hibernate.eclipse.console.common.ConsoleExtension.buildConfiguration(ConsoleExtension.java:266)
   at org.hibernate.eclipse.console.common.ConsoleExtension.runExporters(ConsoleExtension.java:174)
   at org.hibernate.eclipse.console.common.ConsoleExtension.launchExporters(ConsoleExtension.java:110)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:266)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
   at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873)
   at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710)
   at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)
   at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
   at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
   at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
   at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
   at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)
   ... 33 more
!SUBENTRY 1 org.hibernate.eclipse 4 666 2017-02-14 11:10:31.798
!MESSAGE java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
!STACK 0
java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873)
   at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710)
   at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)
   at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
   at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
   at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
   at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
   at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)
   at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.addConnections(PooledConnections.java:123)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:42)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections.<init>(PooledConnections.java:20)
   at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:161)
   at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:109)
   at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:72)
   at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
   at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
   at org.hibernate.cfg.JDBCReaderFactory.newJDBCReader(JDBCReaderFactory.java:37)
   at org.hibernate.cfg.JDBCReaderFactory.newJDBCReader(JDBCReaderFactory.java:24)
   at org.hibernate.cfg.JDBCBinder.readDatabaseSchema(JDBCBinder.java:133)
   at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:110)
   at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:126)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:43)
   at org.jboss.tools.hibernate.runtime.common.AbstractConfigurationFacade.readFromJDBC(AbstractConfigurationFacade.java:208)
   at org.hibernate.eclipse.console.common.ConsoleExtension$2.execute(ConsoleExtension.java:308)
   at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
   at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
   at org.hibernate.eclipse.console.common.ConsoleExtension.buildConfiguration(ConsoleExtension.java:266)
   at org.hibernate.eclipse.console.common.ConsoleExtension.runExporters(ConsoleExtension.java:174)
   at org.hibernate.eclipse.console.common.ConsoleExtension.launchExporters(ConsoleExtension.java:110)
   at org.hibernate.eclipse.launch.CodeGenerationLaunchDelegate.launch(CodeGenerationLaunchDelegate.java:266)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
   at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
   at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
   at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
   at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.