I am getting the below exception when try to launch my maven project (GWT code) ,
INFO org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000401: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/database_name]
INFO org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl - HHH000046: Connection properties: {user=postgres, password=postgres, autocommit=false}
WARN org.hibernate.engine.jdbc.internal.JdbcServicesImpl - HHH000342: Could not obtain connection to query metadata : This ResultSet is closed.
INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
INFO org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000422: Disabling contextual LOB creation as connection was null
INFO org.hibernate.engine.transaction.internal.TransactionFactoryInitiator - HHH000399: Using default transaction strategy (direct JDBC transactions)
INFO org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 4.3.1.Final
WARN org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 0, SQLState: 55000
ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - This ResultSet is closed.
Not able to identify why I am getting this exception. In few searches I found results related to correcting hibernate properties, but my hibernate properties are fine as I am able to connect to other databases in remote machines with my same code, but not my database in localhost.
Note: I am also able query my postgresql database using PGAdmin tool and tried restarting postgresql service, eclipse and finally my system. Nothing worked. Also I am able to connect to my local DB from the same piece of Hibernate code from gradle projects . Please help!
The exception I am getting is from maven project.Also I am able to connect to my local DB from the same piece of Hibernate code from gradle projects .As I explored in debug mode I have found that in ‘org.hibernate.engine.jdbc.internal.JdbcServicesImpl’ , in the method ‘configure’ there is a finally block which is doing ‘jdbcConnectionAccess.releaseConnection( connection );’ , this is the place where the SQL exception occurs ‘The ResulSet is closed’ and caught in catch block and printed as
WARN org.hibernate.engine.jdbc.internal.JdbcServicesImpl - HHH000342: Could not obtain connection to query metadata : This ResultSet is closed.
which seems to be like trying to close the jdbc connection which is already closed. But why it is already closed is what I am not able to understand
My Hibernate properties:
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.password=encrypted_password
hibernate.connection.url=jdbc:postgresql://localhost:5432/database_name
hibernate.connection.username=postgres
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.current_session_context_class=thread
hibernate.show_sql=false
hibernate.format_sql=false
hibernate.connection.autocommit=false
hibernate.jdbc.use_get_generated_keys=true
After hibenate properties are loaded ,
ServiceRegistry serviceRegistry = (new ServiceRegistryBuilder()).applySettings(configuration.getProperties())
.buildServiceRegistry();
this.sessionFactory = configuration.buildSessionFactory(serviceRegistry);
Here buildSessionFactory() will execute the hibernate code where the exception occurs