• Register
0 votes
1.9k 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]
6 5 3
7,540 points

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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 3.7K views
3.7K 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
0 votes
1 answer 1.4K views
1.4K views
Problem : I am a completely novice in the hibernate world and facing below error, WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement The ... hibernate 4 version all my code runs very well. I looked for many solutions but they are not working for me.
asked Feb 4 jwilliam 3.9k points
0 votes
2 answers 87 views
87 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 3.3K views
3.3K views
Problem : I am very new to the hibernate and I want to set up two classes. Also want to create a one to one bidirectional dependency using annotations. I have added all the libraries to the build path. But when i try to run the simple main class by ... .entity.SingleTableEntityPersister Because of this error I am confused. My SQL DB is running via XAMPP. May I get the solution for above error?
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 11 views
11 views
I am facing problem creating a jbdc driver of class. I want to connect it to url null.
asked Sep 22 Daniel Anderson 4k points