• Register
0 votes
2.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

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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 4.4K views
4.4K 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.8K views
1.8K 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, 2020 jwilliam 3.9k points
0 votes
2 answers 124 views
124 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 4.2K views
4.2K 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 23 views
23 views
I am facing problem creating a jbdc driver of class. I want to connect it to url null.
asked Sep 22, 2020 Daniel Anderson 4k points
0 votes
1 answer 204 views
0 votes
2 answers 357 views
357 views
Problem : I want to run the spring-boot application which uses thre hibernate via spring-jpa, but i am facing below error: Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo ... .AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:345) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:308)
asked Jan 3, 2020 alecxe 7.5k points
0 votes
2 answers 273 views
273 views
Problem : I am facing bellow error java.sql.sqlrecoverableexception no more data to read from socket
asked Nov 5, 2019 peterlaw 6.9k points
0 votes
2 answers 300 views
300 views
Problem : I want my database to talk to my Java programs. I am getting following error message. Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The ... (); // ResultSet result = stat.executeQuery( "select * from table" ); System.out.println("Connected?"); } }
asked Dec 10, 2019 alecxe 7.5k points