After updating a database from Postgres 9.6 to 10 all applications stopped working. The error message in the server log file is “Unable to load requested class: pg-uuid”.
The software stack in use is
- Wildfly 10 with Hibernate 5.0.16 (also tested with Wildfly 11 with Hibernate 5.1.10)
- Postgres JDBC driver 42.1.4
- Postgres Server 9.6 updated to Postgres Server 10.1
In the entity I have the following annotations
@Id ... @Type(type = "pg-uuid") private UUID id;
While running on Postgres 9.6 the application was running fine. After the upgrade to 10.1 the application stopped working. The cause is an exception during startup deployment:
Caused by: java.lang.ClassNotFoundException: Could not load requested class : pg-uuid"
I have not found the root cause yet, but I was able to resolve the issue. by adding the following line to the application’s persistence.xml.
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL94Dialect"/>
Dialects of Hibernate 5.0 / 5.1 which is used in Wildfly 10 / 11 supports max up to PostgreSQL94Dialect. PostgreSQL95Dialect has been added in Hibernate 5.2.
Since Hibernate 5.4 PostgresSQL10 dialect is available. At the moment of the update current Wildfly version is 17. Wildfly 17 ships with Hiberate 5.3.10 – so PostgreSQL95Dialect is still the latest version to be used.