having more issues with seting up hibernate with spring3. this time it is saying that connection is nul as the dialect is not set which it is on my hibernate.cfg.xml file.
i think you are not configure hibernate.cfg.xml.
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");
SessionFactory factory = configuration.buildSessionFactory();
We were recently facing the same issue with one of our deployment, as we were also using hibernate and dialect is null is a vague error. I use was with connection string itself and did the changes below to make it work
connectionUrl :- jdbc:mysql://127.0.0.1:3306/{{dbName}}?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false
Steps how did we solve it 1) We ran simple DB connection with JDBC driver that will gave the exception of time zone. 2) we found the issue with time zone and had to add more properties in connection string as show above. 3) We also added 2 other properties as still it was not working.
Dialect is not set is vague to took lot of our time, I hope this helps.
You did't post your session factory initialization code. But I guess this is the same problem with this one
From Hibernate 4.3.2.Final, StandardServiceRegistryBuilder is introduced. Please follow this order to intialize, e.g.:
Configuration configuration = new Configuration();
configuration.configure("com/jeecourse/config/hibernate.cfg.xml");
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(
configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
Please double check your code.
I think you don't create the Configuration like below.
Configuration conf = new Configuration().configure();
Best
I think your datasource-config.xml
is not in classpath
instead of having this file in WEB-INF/datasource-config.xml
copy it to WEB-INF/classes/datasource-config.xml
I had the the same problem and the issue was, that my computer was not entered in the pg_hba.conf of the postgres database that allows which Clients(IP-Adresses) are allowed to speak with the database.
btw: Other users tells that the error raises too if they simply forget starting database service locally