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)
- PostgreSQL JDBC driver 42.1.4
- PostgreSQL Server 9.6 updated to PostgreSQL Server 10.1
In the entity I have the following annotations
@Id ... @Type(type = "pg-uuid") private UUID id;
While running on PostgreSQL 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"/>
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.