• Register
0 votes
5.3k views

Problem :

I want to configure the hibernate orm mapping tool to my java class and want to use PostgreSQL as my database also I have configured the password as "password". But when I tried to run the application, I am facing following error on my console logs as Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]. I have also tried this on old version of hibernate and it worked. And the hibernate version that I am currently using is version 5.1.0.

The following is my error log:

Dec 03, 2019 3:55:09 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
Dec 03, 2019 3:55:09 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Dec 03, 2019 3:55:09 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Dec 03, 2019 3:55:09 PM org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
Dec 03, 2019 3:55:10PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Dec 03, 2019 3:55:10PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
Dec 03, 2019 3:55:10PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/hibernatedb]
Dec 03, 2019 3:55:10PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=sa, password=****}
Dec 03, 2019 3:55:10PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
Dec 03, 2019 3:55:10PM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had got the same error and changed the following

SessionFactory mySessionFactory =
new Configuration().configure().buildSessionFactory();

to below code

SessionFactory mySessionFactory =
new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();

It worked for me.

38.6k points

Related questions

0 votes
1 answer 216 views
216 views
Problem: why I cant fix this : Unable to create requested service [org.hibernate.engine.jdbc.env.spi.jdbcenvironment] .
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
1 answer 29 views
29 views
Problem: Please, need a solution : Unable to create requested service [org.hibernate.engine.jdbc.env.spi.jdbcenvironment].
asked Jun 13 Aurelia Maja 78.4k points
0 votes
1 answer 37 views
37 views
Problem: Help! Why I get the following exception > Org.hibernate.lazyinitializationexception: could not initialize proxy - no session
asked Apr 25 ummeshani 10.8k points
0 votes
1 answer 214 views
214 views
Problem : After executing spring boot with h2 database and JPA i am facing below error, any help: org.hibernate.tool.schema.spi.commandacceptanceexception: error executing ddl via jdbc statement
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
1 answer 5.8k views
5.8k views
Problem : After executing spring boot with h2 database and JPA i am facing below error org.hibernate.tool.schema.spi.commandacceptanceexception: error executing ddl via jdbc statement
asked Nov 12, 2019 peterlaw 6.9k points
1 vote
1 answer 413 views
413 views
Problem : HELP! I need help understanding this error: Error creating bean with name 'employeeRepositoryDAOImple': Unsatisfied dependency expressed through method 'setSessionFactory' parameter 0; nested exception is org.springframework.beans.factory. ... failed; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
asked Mar 12 Sabbir Hossain 14.6k points
0 votes
1 answer 3 views
3 views
Problem : Is there any way to rectify this problem: A custom exception class must always have a no argument constructor?
asked Jun 18 Siam55 110k points
0 votes
1 answer 30 views
30 views
Problem: I am trying to find out an answer but need someone&rsquo;s help .. Could not initialize proxy - no session
asked May 24 Ifra 43.4k points
0 votes
2 answers 306 views
306 views
Problem : I am facing the following error when I save the object using Hibernate: object references an unsaved transient instance - save the transient instance before flushing:
asked Nov 14, 2019 peterlaw 6.9k points
0 votes
1 answer 105 views
105 views
Problem : I am a completely novice in the hibernate world and facing this error: Generationtarget encountered exception accepting command : error executing ddl via jdbc statement .
asked Mar 13 Wafa Abu Yousef 6.1k points