Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 583 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connection cannot be null when 'hibernate.dialect' not set

#11
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`
Reply

#12
Creation of `ServiceRegistry` instance separately and pass it to `buildSessionFactory` may cause this error. Try to create `SessionFactory` instance as follows:


private static SessionFactory factory;
factory = cfg.buildSessionFactory(
new ServiceRegistryBuilder().applySettings(cfg.getProperties())
.buildServiceRegistry());

Reply

#13
This issue comes if your mysql-connector version and mysql-installer version is different.

Internally it will throw Caused by:

>com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client.

So you need make your mysql-connector version and mysql-installer version same...

Reply

#14
Added the following in persistence.xml file,

<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
Reply

#15
I had this error with JPA, then I just added this line to application.properties:

spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
based on this post:

[To see links please register here]

Reply

#16
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.
Reply

#17


This worked for me added the dialect property...
```
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence

[To see links please register here]

;
<persistence-unit name="project_name" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="root"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.schema-generation.drop-source" value="script-then-metadata"/>
<property name="dialect" value="org.hibernate.dialect.MySQLDialect"/>
</properties>
</persistence-unit>
</persistence>
```
Reply

#18
I face this problem when I project update , the error is javax.persistence.jdbc.url', 'hibernate.connection.url', or 'hibernate.dialect'

and I found the solution. it work fine.

[here is the details solution][1]

[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through